[gtk/gtk-3-24.ime-event.fixes: 9/9] gdkevents-win32.c: Send gtk-im-module settings change as needed



commit b270ec8f84c4b1b60c7d01fde01265d9ba31d974
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Mon Dec 10 14:47:17 2018 +0800

    gdkevents-win32.c: Send gtk-im-module settings change as needed
    
    Send the gtk-im-module settings change notification here when we are
    activating IME for CJK locales, if not already done so.
    
    This will avoid a crash when we are changing from, for example, a
    Chinese input method to a Korean input method, and vice-versa.

 gdk/win32/gdkevents-win32.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c
index a2698e3cfc..d063dcbd77 100644
--- a/gdk/win32/gdkevents-win32.c
+++ b/gdk/win32/gdkevents-win32.c
@@ -2311,6 +2311,8 @@ gdk_event_translate (MSG  *msg,
 
   STGMEDIUM *property_change_data;
 
+  gboolean _gdk_input_locale_is_ime_current;
+
   display = gdk_display_get_default ();
   window = gdk_win32_handle_table_lookup (msg->hwnd);
 
@@ -2462,6 +2464,7 @@ gdk_event_translate (MSG  *msg,
   switch (msg->message)
     {
     case WM_INPUTLANGCHANGE:
+      _gdk_input_locale_is_ime_current = _gdk_input_locale_is_ime;
       _gdk_input_locale = (HKL) msg->lParam;
       _gdk_win32_keymap_set_active_layout (GDK_WIN32_KEYMAP (_gdk_win32_display_get_keymap (_gdk_display)), 
_gdk_input_locale);
       _gdk_input_locale_is_ime = ImmIsIME (_gdk_input_locale);
@@ -2475,7 +2478,10 @@ gdk_event_translate (MSG  *msg,
                         (gulong) msg->wParam,
                         (gpointer) msg->lParam, _gdk_input_locale_is_ime ? " (IME)" : "",
                         _gdk_input_codepage));
-      gdk_settings_notify (window, "gtk-im-module", GDK_SETTING_ACTION_CHANGED);
+
+      if (!_gdk_input_locale_is_ime_current)
+        gdk_settings_notify (window, "gtk-im-module", GDK_SETTING_ACTION_CHANGED);
+
       break;
 
     case WM_SYSKEYUP:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]