summaryrefslogtreecommitdiff
path: root/modules/input/gtkimcontextxim.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2012-09-30 20:33:38 -0400
committerMatthias Clasen <mclasen@redhat.com>2012-10-01 22:12:07 -0400
commitd6809d050a8666f7c98ee4b74f22ff828782fe16 (patch)
tree7544a7580561c56d238ce2448751a649cf408d91 /modules/input/gtkimcontextxim.c
parent307a1dc638ca3ac71f1025655d7e82b4cd0825f2 (diff)
downloadgtk+-d6809d050a8666f7c98ee4b74f22ff828782fe16.tar.gz
XIM: Don't force random windows to become native
GDK_WINDOW_XID() has the side-effect of turning a window native; this in turn can have unexpected effects such as black backgrounds. Avoid this by using the XID of the toplevel. https://bugzilla.gnome.org/show_bug.cgi?id=682395
Diffstat (limited to 'modules/input/gtkimcontextxim.c')
-rw-r--r--modules/input/gtkimcontextxim.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/modules/input/gtkimcontextxim.c b/modules/input/gtkimcontextxim.c
index 1a32e5abfd..6a20b60e7f 100644
--- a/modules/input/gtkimcontextxim.c
+++ b/modules/input/gtkimcontextxim.c
@@ -697,18 +697,21 @@ gtk_im_context_xim_filter_keypress (GtkIMContext *context,
KeySym keysym;
Status status;
gboolean result = FALSE;
- GdkWindow *root_window = gdk_screen_get_root_window (gdk_window_get_screen (event->window));
-
+ GdkWindow *root_window;
+ GdkWindow *window;
XKeyPressedEvent xevent;
if (event->type == GDK_KEY_RELEASE && !context_xim->filter_key_release)
return FALSE;
+ root_window = gdk_screen_get_root_window (gdk_window_get_screen (event->window));
+ window = gdk_window_get_toplevel (event->window);
+
xevent.type = (event->type == GDK_KEY_PRESS) ? KeyPress : KeyRelease;
xevent.serial = 0; /* hope it doesn't matter */
xevent.send_event = event->send_event;
- xevent.display = GDK_WINDOW_XDISPLAY (event->window);
- xevent.window = GDK_WINDOW_XID (event->window);
+ xevent.display = GDK_WINDOW_XDISPLAY (window);
+ xevent.window = GDK_WINDOW_XID (window);
xevent.root = GDK_WINDOW_XID (root_window);
xevent.subwindow = xevent.window;
xevent.time = event->time;