Fix T47841: Shift-space doesn't type space in type-in fields on Windows

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.
This commit is contained in:
Sergey Sharybin 2016-05-03 12:18:53 +02:00
parent bff15770a9
commit b34f177a39
Notes: blender-bot 2023-05-03 10:14:48 +02:00
Referenced by issue #47841, Shift-space doesn't type space in type-in fields (user expectation bug?)
1 changed files with 7 additions and 6 deletions

View 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
)
{