[Bf-blender-cvs] [6b7756279f7] master: Fix T93626: Win IME Chinese Numpad Decimal

Harley Acheson noreply at git.blender.org
Fri Jan 28 22:33:35 CET 2022


Commit: 6b7756279f719a434505d461fb03b5faa5ce9aa0
Author: Harley Acheson
Date:   Fri Jan 28 13:32:46 2022 -0800
Branches: master
https://developer.blender.org/rB6b7756279f719a434505d461fb03b5faa5ce9aa0

Fix T93626: Win IME Chinese Numpad Decimal

Allow Windows IME Pinyin, when in Chinese mode, to use numpad decimal
key to enter decimal point.

See D13902 for more details.

Differential Revision: https://developer.blender.org/D13902

Reviewed by Brecht Van Lommel

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

M	intern/ghost/intern/GHOST_ImeWin32.cpp
M	intern/ghost/intern/GHOST_ImeWin32.h
M	intern/ghost/intern/GHOST_SystemWin32.cpp

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

diff --git a/intern/ghost/intern/GHOST_ImeWin32.cpp b/intern/ghost/intern/GHOST_ImeWin32.cpp
index d1fc80adf56..2a1bfb633b3 100644
--- a/intern/ghost/intern/GHOST_ImeWin32.cpp
+++ b/intern/ghost/intern/GHOST_ImeWin32.cpp
@@ -96,7 +96,7 @@ bool GHOST_ImeWin32::IsEnglishMode()
          !(conversion_modes_ & (IME_CMODE_NATIVE | IME_CMODE_FULLSHAPE));
 }
 
-bool GHOST_ImeWin32::IsImeKeyEvent(char ascii)
+bool GHOST_ImeWin32::IsImeKeyEvent(char ascii, GHOST_TKey key)
 {
   if (!(IsEnglishMode())) {
     /* In Chinese, Japanese, Korean, all alpha keys are processed by IME. */
@@ -106,7 +106,8 @@ bool GHOST_ImeWin32::IsImeKeyEvent(char ascii)
     if (IsLanguage(IMELANG_JAPANESE) && (ascii >= ' ' && ascii <= '~')) {
       return true;
     }
-    else if (IsLanguage(IMELANG_CHINESE) && ascii && strchr("!\"$'(),.:;<>?[\\]^_`/", ascii)) {
+    else if (IsLanguage(IMELANG_CHINESE) && ascii && strchr("!\"$'(),.:;<>?[\\]^_`/", ascii) &&
+             !(key == GHOST_kKeyNumpadPeriod)) {
       return true;
     }
   }
diff --git a/intern/ghost/intern/GHOST_ImeWin32.h b/intern/ghost/intern/GHOST_ImeWin32.h
index ce0e4d64d53..d17a6d79503 100644
--- a/intern/ghost/intern/GHOST_ImeWin32.h
+++ b/intern/ghost/intern/GHOST_ImeWin32.h
@@ -161,7 +161,7 @@ class GHOST_ImeWin32 {
   bool IsEnglishMode();
 
   /* Checks a key whether IME has to do handling. */
-  bool IsImeKeyEvent(char ascii);
+  bool IsImeKeyEvent(char ascii, GHOST_TKey key);
 
   /**
    * Create the IME windows, and allocate required resources for them.
diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp
index 5251dd01b29..64e1ac3b9b3 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -1220,7 +1220,7 @@ GHOST_EventKey *GHOST_SystemWin32::processKeyEvent(GHOST_WindowWin32 *window, RA
     }
 
 #ifdef WITH_INPUT_IME
-    if (window->getImeInput()->IsImeKeyEvent(ascii)) {
+    if (window->getImeInput()->IsImeKeyEvent(ascii, key)) {
       return NULL;
     }
 #endif /* WITH_INPUT_IME */



More information about the Bf-blender-cvs mailing list