[gtk+/wip/otte/vulkan] xim: Use the native parent window for the X connection



commit b83bac25801ce34e34e1a1f2010c7b7e675a9444
Author: Benjamin Otte <otte redhat com>
Date:   Tue Dec 6 00:09:59 2016 +0100

    xim: Use the native parent window for the X connection
    
    Don't try to gdk_window_get_xid() on the current window.

 modules/input/gtkimcontextxim.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/modules/input/gtkimcontextxim.c b/modules/input/gtkimcontextxim.c
index 4519d13..886e2e6 100644
--- a/modules/input/gtkimcontextxim.c
+++ b/modules/input/gtkimcontextxim.c
@@ -37,6 +37,7 @@ struct _GtkIMContextXIM
   gchar *mb_charset;
 
   GdkWindow *client_window;
+  Window client_window_xid;
   GtkWidget *client_widget;
 
   /* The status window for this input context; we claim the
@@ -572,11 +573,23 @@ set_ic_client_window (GtkIMContextXIM *context_xim,
     }
   
   context_xim->client_window = client_window;
+  context_xim->client_window_xid = None;
 
   if (context_xim->client_window)
     {
+      GdkWindow *native;
+
       context_xim->im_info = get_im (context_xim->client_window, context_xim->locale);
       context_xim->im_info->ics = g_slist_prepend (context_xim->im_info->ics, context_xim);
+
+      for (native = client_window; native; native = gdk_window_get_parent (native))
+        {
+          if (gdk_window_has_native (native))
+            {
+              context_xim->client_window_xid = gdk_x11_window_get_xid (native);
+              break;
+            }
+        }
     }
   
   update_client_widget (context_xim);
@@ -670,7 +683,7 @@ gtk_im_context_xim_filter_keypress (GtkIMContext *context,
   xevent.keycode = event->hardware_keycode;
   xevent.same_screen = True;
   
-  if (XFilterEvent ((XEvent *)&xevent, GDK_WINDOW_XID (context_xim->client_window)))
+  if (XFilterEvent ((XEvent *)&xevent, context_xim->client_window_xid))
     return TRUE;
   
   if (event->state &
@@ -1386,7 +1399,7 @@ gtk_im_context_xim_get_ic (GtkIMContextXIM *context_xim)
 
       xic = XCreateIC (context_xim->im_info->im,
                       XNInputStyle, im_style,
-                      XNClientWindow, GDK_WINDOW_XID (context_xim->client_window),
+                      XNClientWindow, context_xim->client_window_xid,
                       name1, list1,
                       name2, list2,
                       NULL);


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