[Bf-blender-cvs] [c8f95cb] master: Only enable IME for supported translation contexts

Severin noreply at git.blender.org
Thu Mar 26 22:19:27 CET 2015


Commit: c8f95cbb604ce833b759b134b36dd7ea42d69d76
Author: Severin
Date:   Thu Mar 26 22:16:00 2015 +0100
Branches: master
https://developer.blender.org/rBc8f95cbb604ce833b759b134b36dd7ea42d69d76

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.

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

M	source/blender/editors/interface/interface_handlers.c

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

diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 6ef414b..b4f2699 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




More information about the Bf-blender-cvs mailing list