Commit: 122ad8ac6d8d0936178663f30b71eaccc134f88d
Author: Severin
Date:   Tue Nov 18 15:57:03 2014 +0100
Branches: input_method_editor
https://developer.blender.org/rB122ad8ac6d8d0936178663f30b71eaccc134f88d

Cleanup: Moar whitespace cleanup, plus remove missed printf

Hope that was the last cleanup commit for now :/

===================================================================

M       intern/ghost/CMakeLists.txt
M       intern/ghost/intern/GHOST_ImeWin32.cpp
M       intern/ghost/intern/GHOST_ImeWin32.h

===================================================================

diff --git a/intern/ghost/CMakeLists.txt b/intern/ghost/CMakeLists.txt
index 555d66d..acd8c1d 100644
--- a/intern/ghost/CMakeLists.txt
+++ b/intern/ghost/CMakeLists.txt
@@ -284,6 +284,7 @@ elseif(WIN32)
                add_definitions(-DWITH_INPUT_IME)
                list(APPEND SRC
                        intern/GHOST_ImeWin32.cpp
+                       
                        intern/GHOST_ImeWin32.h
                )
        endif()
diff --git a/intern/ghost/intern/GHOST_ImeWin32.cpp 
b/intern/ghost/intern/GHOST_ImeWin32.cpp
index 96dd36c..7430c12 100644
--- a/intern/ghost/intern/GHOST_ImeWin32.cpp
+++ b/intern/ghost/intern/GHOST_ImeWin32.cpp
@@ -39,12 +39,12 @@
 
 GHOST_ImeWin32::GHOST_ImeWin32()
     : ime_status_(false),
-    input_language_id_(LANG_USER_DEFAULT),
-    is_composing_(false),
-    system_caret_(false),
-    caret_rect_(-1, -1, 0, 0),
-    is_first(true),
-    is_enable(true)
+      input_language_id_(LANG_USER_DEFAULT),
+      is_composing_(false),
+      system_caret_(false),
+      caret_rect_(-1, -1, 0, 0),
+      is_first(true),
+      is_enable(true)
 {
 }
 
@@ -56,467 +56,463 @@ GHOST_ImeWin32::~GHOST_ImeWin32()
 
 bool GHOST_ImeWin32::SetInputLanguage()
 {
-    /**
-     * Retrieve the current keyboard layout from Windows and determine whether
-     * or not the current input context has IMEs.
-     * Also save its input language for language-specific operations required
-     * while composing a text.
-     */
-    HKL keyboard_layout = ::GetKeyboardLayout(0);
-    input_language_id_ = reinterpret_cast<LANGID>(keyboard_layout);
-    ime_status_ = ::ImmIsIME(keyboard_layout);
-    return ime_status_;
+       /**
+        * Retrieve the current keyboard layout from Windows and determine 
whether
+        * or not the current input context has IMEs.
+        * Also save its input language for language-specific operations 
required
+        * while composing a text.
+        */
+       HKL keyboard_layout = ::GetKeyboardLayout(0);
+       input_language_id_ = reinterpret_cast<LANGID>(keyboard_layout);
+       ime_status_ = ::ImmIsIME(keyboard_layout);
+       return ime_status_;
 }
 
 
 void GHOST_ImeWin32::CreateImeWindow(HWND window_handle)
 {
-    /**
-     * When a user disables TSF (Text Service Framework) and CUAS (Cicero
-     * Unaware Application Support), Chinese IMEs somehow ignore function calls
-     * to ::ImmSetCandidateWindow(), i.e. they do not move their candidate
-     * window to the position given as its parameters, and use the position
-     * of the current system caret instead, i.e. it uses ::GetCaretPos() to
-     * retrieve the position of their IME candidate window.
-     * Therefore, we create a temporary system caret for Chinese IMEs and use
-     * it during this input context.
-     * Since some third-party Japanese IME also uses ::GetCaretPos() to 
determine
-     * their window position, we also create a caret for Japanese IMEs.
-     */
-    if (PRIMARYLANGID(input_language_id_) == LANG_CHINESE ||
-        PRIMARYLANGID(input_language_id_) == LANG_JAPANESE) {
-        if (!system_caret_) {
-            if (::CreateCaret(window_handle, NULL, 1, 1)) {
-                system_caret_ = true;
-            }
-        }
+       /**
+        * When a user disables TSF (Text Service Framework) and CUAS (Cicero
+        * Unaware Application Support), Chinese IMEs somehow ignore function 
calls
+        * to ::ImmSetCandidateWindow(), i.e. they do not move their candidate
+        * window to the position given as its parameters, and use the position
+        * of the current system caret instead, i.e. it uses ::GetCaretPos() to
+        * retrieve the position of their IME candidate window.
+        * Therefore, we create a temporary system caret for Chinese IMEs and 
use
+        * it during this input context.
+        * Since some third-party Japanese IME also uses ::GetCaretPos() to 
determine
+        * their window position, we also create a caret for Japanese IMEs.
+        */
+       if (PRIMARYLANGID(input_language_id_) == LANG_CHINESE ||
+               PRIMARYLANGID(input_language_id_) == LANG_JAPANESE) {
+               if (!system_caret_) {
+                       if (::CreateCaret(window_handle, NULL, 1, 1)) {
+                               system_caret_ = true;
+                       }
+               }
        }
-#ifdef WITH_INPUT_IME
-       printf("ime works\n");
-#endif
-    /* Restore the positions of the IME windows. */
-    UpdateImeWindow(window_handle);
+       /* Restore the positions of the IME windows. */
+       UpdateImeWindow(window_handle);
 }
 
 
-void GHOST_ImeWin32::SetImeWindowStyle(HWND window_handle, UINT message, 
WPARAM wparam, LPARAM lparam, BOOL* handled)
+void GHOST_ImeWin32::SetImeWindowStyle(HWND window_handle, UINT message, 
WPARAM wparam, LPARAM lparam, BOOL *handled)
 {
-    /**
-     * To prevent the IMM (Input Method Manager) from displaying the IME
-     * composition window, Update the styles of the IME windows and EXPLICITLY
-     * call ::DefWindowProc() here.
-     * NOTE(hbono): We can NEVER let WTL call ::DefWindowProc() when we update
-     * the styles of IME windows because the 'lparam' variable is a local one
-     * and all its updates disappear in returning from this function, i.e. WTL
-     * does not call ::DefWindowProc() with our updated 'lparam' value but call
-     * the function with its original value and over-writes our window styles.
-     */
-    *handled = TRUE;
-    lparam &= ~ISC_SHOWUICOMPOSITIONWINDOW;
-    ::DefWindowProc(window_handle, message, wparam, lparam);
+       /**
+        * To prevent the IMM (Input Method Manager) from displaying the IME
+        * composition window, Update the styles of the IME windows and 
EXPLICITLY
+        * call ::DefWindowProc() here.
+        * NOTE(hbono): We can NEVER let WTL call ::DefWindowProc() when we 
update
+        * the styles of IME windows because the 'lparam' variable is a local 
one
+        * and all its updates disappear in returning from this function, i.e. 
WTL
+        * does not call ::DefWindowProc() with our updated 'lparam' value but 
call
+        * the function with its original value and over-writes our window 
styles.
+        */
+       *handled = TRUE;
+       lparam &= ~ISC_SHOWUICOMPOSITIONWINDOW;
+       ::DefWindowProc(window_handle, message, wparam, lparam);
 }
 
 
 void GHOST_ImeWin32::DestroyImeWindow(HWND window_handle)
 {
-    /* Destroy the system caret if we have created for this IME input context. 
*/
-    if (system_caret_) {
-        ::DestroyCaret();
-        system_caret_ = false;
-    }
+       /* Destroy the system caret if we have created for this IME input 
context. */
+       if (system_caret_) {
+               ::DestroyCaret();
+               system_caret_ = false;
+       }
 }
 
 
 void GHOST_ImeWin32::MoveImeWindow(HWND window_handle, HIMC imm_context)
 {
-    int x = caret_rect_.m_l;
-    int y = caret_rect_.m_t;
-    const int kCaretMargin = 1;
-    /**
-     * As written in a comment in GHOST_ImeWin32::CreateImeWindow(),
-     * Chinese IMEs ignore function calls to ::ImmSetCandidateWindow()
-     * when a user disables TSF (Text Service Framework) and CUAS (Cicero
-     * Unaware Application Support).
-     * On the other hand, when a user enables TSF and CUAS, Chinese IMEs
-     * ignore the position of the current system caret and uses the
-     * parameters given to ::ImmSetCandidateWindow() with its 'dwStyle'
-     * parameter CFS_CANDIDATEPOS.
-     * Therefore, we do not only call ::ImmSetCandidateWindow() but also
-     * set the positions of the temporary system caret if it exists.
-     */
-    CANDIDATEFORM candidate_position = {0, CFS_CANDIDATEPOS, {x, y},
-                                       {0, 0, 0, 0}};
-    ::ImmSetCandidateWindow(imm_context, &candidate_position);
-    if (system_caret_) {
-        switch (PRIMARYLANGID(input_language_id_)) {
-        case LANG_JAPANESE:
-            ::SetCaretPos(x, y + caret_rect_.getHeight());
-            break;
-        default:
-            ::SetCaretPos(x, y);
-            break;
-        }
-    }
-    if (PRIMARYLANGID(input_language_id_) == LANG_KOREAN) {
-        /**
-         * Chinese IMEs and Japanese IMEs require the upper-left corner of
-         * the caret to move the position of their candidate windows.
-         * On the other hand, Korean IMEs require the lower-left corner of the
-         * caret to move their candidate windows.
-         */
-        y += kCaretMargin;
-    }
-    /**
-     * Japanese IMEs and Korean IMEs also use the rectangle given to
-     * ::ImmSetCandidateWindow() with its 'dwStyle' parameter CFS_EXCLUDE
-     * to move their candidate windows when a user disables TSF and CUAS.
-     * Therefore, we also set this parameter here.
-     */
-    CANDIDATEFORM exclude_rectangle = {0, CFS_EXCLUDE, {x, y},
-    {x, y, x + caret_rect_.getWidth(), y + caret_rect_.getHeight()}};
-    ::ImmSetCandidateWindow(imm_context, &exclude_rectangle);
+       int x = caret_rect_.m_l;
+       int y = caret_rect_.m_t;
+       const int kCaretMargin = 1;
+       /**
+        * As written in a comment in GHOST_ImeWin32::CreateImeWindow(),
+        * Chinese IMEs ignore function calls to ::ImmSetCandidateWindow()
+        * when a user disables TSF (Text Service Framework) and CUAS (Cicero
+        * Unaware Application Support).
+        * On the other hand, when a user enables TSF and CUAS, Chinese IMEs
+        * ignore the position of the current system caret and uses the
+        * parameters given to ::ImmSetCandidateWindow() with its 'dwStyle'
+        * parameter CFS_CANDIDATEPOS.
+        * Therefore, we do not only call ::ImmSetCandidateWindow() but also
+        * set the positions of the temporary system caret if it exists.
+        */
+       CANDIDATEFORM candidate_position = { 0, CFS_CANDIDATEPOS, { x, y },
+       { 0, 0, 0, 0 } };
+       ::ImmSetCandidateWindow(imm_context, &candidate_position);
+       if (system_caret_) {
+               switch (PRIMARYLANGID(input_language_id_)) {
+               case LANG_JAPANESE:
+                       ::SetCaretPos(x, y + caret_rect_.getHeight());
+                       break;
+               default:
+                       ::SetCaretPos(x, y);
+                       break;
+               }
+       }
+       if (PRIMARYLANGID(input_language_id_) == LANG_KOREAN) {
+               /**
+                * Chinese IMEs and Japanese IMEs require the upper-left corner 
of
+                * the caret to move the position of their candidate windows.
+                * On the other hand, Korean IMEs require the lower-left corner 
of the
+                * caret to move their candidate windows.
+                */
+               y += kCaretMargin;
+       }
+       /**
+        * Japanese IMEs and Korean IMEs also use the rectangle given to
+        * ::ImmSetCandidateWindow() with its 'dwStyle' parameter CFS_EXCLUDE
+        * to move their candidate windows when a user disables TSF and CUAS.
+        * Therefore, we also set this parameter here.
+        */
+       CANDIDATEFORM excl

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to