From 453020c31589293a5788b36720c1241fd4a8fbde Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Thu, 7 Feb 2013 17:33:17 -0500 Subject: [PATCH] Make sure to include the old XI2 mask when selecting for events Some windows may already have event masks on them that we've selected for, especially if we're using GTK+ windows. In particular, this fixes window menus in the XI2 port. https://bugzilla.gnome.org/show_bug.cgi?id=690581 --- src/compositor/compositor.c | 5 +++++ src/core/screen.c | 2 ++ src/core/window.c | 2 ++ 3 files changed, 9 insertions(+) diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c index 105464fca..b92302e4d 100644 --- a/src/compositor/compositor.c +++ b/src/compositor/compositor.c @@ -4,6 +4,7 @@ #include +#include "core.h" #include #include #include @@ -163,6 +164,8 @@ get_output_window (MetaScreen *screen) xroot = meta_screen_get_xroot (screen); output = XCompositeGetOverlayWindow (xdisplay, xroot); + meta_core_add_old_event_mask (xdisplay, output, &mask); + XISetMask (mask.mask, XI_KeyPress); XISetMask (mask.mask, XI_KeyRelease); XISetMask (mask.mask, XI_ButtonPress); @@ -550,6 +553,8 @@ meta_compositor_manage_screen (MetaCompositor *compositor, XIEventMask mask = { XIAllMasterDevices, sizeof (mask_bits), mask_bits }; XWindowAttributes attr; + meta_core_add_old_event_mask (xdisplay, xwin, &mask); + XISetMask (mask.mask, XI_KeyPress); XISetMask (mask.mask, XI_KeyRelease); XISetMask (mask.mask, XI_ButtonPress); diff --git a/src/core/screen.c b/src/core/screen.c index 4b41dc3a6..73d717347 100644 --- a/src/core/screen.c +++ b/src/core/screen.c @@ -748,6 +748,8 @@ meta_screen_new (MetaDisplay *display, XIEventMask mask = { XIAllMasterDevices, sizeof (mask_bits), mask_bits }; XWindowAttributes attr; + meta_core_add_old_event_mask (xdisplay, xroot, &mask); + XISetMask (mask.mask, XI_KeyPress); XISetMask (mask.mask, XI_KeyRelease); XISetMask (mask.mask, XI_Enter); diff --git a/src/core/window.c b/src/core/window.c index ead4d810f..e669fa701 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -939,6 +939,8 @@ meta_window_new_with_attrs (MetaDisplay *display, unsigned char mask_bits[XIMaskLen (XI_LASTEVENT)] = { 0 }; XIEventMask mask = { XIAllMasterDevices, sizeof (mask_bits), mask_bits }; + meta_core_add_old_event_mask (display->xdisplay, xwindow, &mask); + XISetMask (mask.mask, XI_Enter); XISetMask (mask.mask, XI_Leave); XISetMask (mask.mask, XI_FocusIn);