imwayland: Connect gtk_im_context_focus_in/out to GtkEventControllerKey
authorTakao Fujiwara <tfujiwar@redhat.com>
Tue, 28 Jan 2020 14:47:16 +0000 (23:47 +0900)
committerTakao Fujiwara <tfujiwar@redhat.com>
Tue, 28 Jan 2020 14:47:16 +0000 (23:47 +0900)
GtkEventControllerKey can handle GDK_FOCUS_CHANGE and call
gtk_im_context_focus_in/out directly.

https://gitlab.gnome.org/GNOME/gtk/issues/2390

gtk/gtkeventcontrollerkey.c

index 07c8b8150cdb2a3a02ba50a5fe029bfe30a08e39..db7acbc8fd9f330436fde4f856fa63977a7a0060 100644 (file)
@@ -129,6 +129,13 @@ update_focus (GtkEventControllerKey *key,
     {
       key->is_focus = is_focus;
       g_object_notify (G_OBJECT (key), "is-focus");
+      if (key->im_context)
+        {
+          if (focus_in)
+            gtk_im_context_focus_in (key->im_context);
+          else
+            gtk_im_context_focus_out (key->im_context);
+        }
     }
   if (key->contains_focus != contains_focus)
     {