diff options
author | Severin <julian_eisel@web.de> | 2015-03-27 00:16:00 +0300 |
---|---|---|
committer | Severin <julian_eisel@web.de> | 2015-03-27 00:16:00 +0300 |
commit | c8f95cbb604ce833b759b134b36dd7ea42d69d76 (patch) | |
tree | e8c1a09d619d330e8735600e150ca655fa1df88f /source/blender/editors/interface | |
parent | 065e5896c4ecda26952770813696ca051ca7cd41 (diff) |
Only enable IME for supported translation contexts
For me, weird characters are drawn if IME is enabled but translation
is not set to a supported language.
Could become an utility function if needed later.
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 6ef414b88ea..b4f26998c77 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -2446,6 +2446,18 @@ static bool ui_textedit_copypaste(uiBut *but, uiHandleButtonData *data, const in } #ifdef WITH_INPUT_IME +/* test if the translation context allows IME input - used to + * avoid weird character drawing if IME inputs non-ascii chars */ +static bool ui_ime_is_lang_supported(void) +{ + const char *uilng = BLF_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); +} + /* enable ime, and set up uibut ime data */ static void ui_textedit_ime_begin(wmWindow *win, uiBut *UNUSED(but)) { @@ -2550,7 +2562,7 @@ static void ui_textedit_begin(bContext *C, uiBut *but, uiHandleButtonData *data) WM_cursor_modal_set(win, BC_TEXTEDITCURSOR); #ifdef WITH_INPUT_IME - if (is_num_but == false) { + if (is_num_but == false && ui_ime_is_lang_supported()) { ui_textedit_ime_begin(win, but); } #endif |