Fix T47841: Shift-space doesn't type space in type-in fields on Windows
authorSergey Sharybin <sergey.vfx@gmail.com>
Tue, 3 May 2016 10:18:53 +0000 (12:18 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Tue, 3 May 2016 10:20:40 +0000 (12:20 +0200)
Shift-space was reserved for IME support, however IME will only
be enabled on certain languages. We can avoid any IME-related
exceptions form other languages without too much trouble.

There's one weak point around ui_ime_is_lang_supported() tho,
which is it might be doing string comparison a bit too much
often now, this we can avoid by handling those checks from BLT.

source/blender/editors/interface/interface_handlers.c

index ce264051609549d874d4fe5f70ca2cc60687bc95..c6cd03d7ac710d16c2bb754e5d9d0084beea90e1 100644 (file)
@@ -2950,11 +2950,12 @@ static bool ui_textedit_copypaste(uiBut *but, uiHandleButtonData *data, const in
 static bool ui_ime_is_lang_supported(void)
 {
        const char *uilng = BLT_lang_get();
-       const bool is_lang_supported = STREQ(uilng, "zh_CN") ||
-                                      STREQ(uilng, "zh_TW") ||
-                                      STREQ(uilng, "ja_JP");
-
-       return ((U.transopts & USER_DOTRANSLATE) && is_lang_supported);
+       if (U.transopts & USER_DOTRANSLATE) {
+               return STREQ(uilng, "zh_CN") ||
+                      STREQ(uilng, "zh_TW") ||
+                      STREQ(uilng, "ja_JP");
+       }
+       return false;
 }
 
 /* enable ime, and set up uibut ime data */
@@ -3405,7 +3406,7 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
 #ifdef WITH_INPUT_IME
                    &&
                    !is_ime_composing &&
-                   !WM_event_is_ime_switch(event)
+                   (!WM_event_is_ime_switch(event) || !ui_ime_is_lang_supported())
 #endif
                    )
                {