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
This commit is contained in:
Jasper St. Pierre 2013-02-07 17:33:17 -05:00
parent d794db876a
commit 453020c315
3 changed files with 9 additions and 0 deletions

View File

@ -4,6 +4,7 @@
#include <clutter/x11/clutter-x11.h> #include <clutter/x11/clutter-x11.h>
#include "core.h"
#include <meta/screen.h> #include <meta/screen.h>
#include <meta/errors.h> #include <meta/errors.h>
#include <meta/window.h> #include <meta/window.h>
@ -163,6 +164,8 @@ get_output_window (MetaScreen *screen)
xroot = meta_screen_get_xroot (screen); xroot = meta_screen_get_xroot (screen);
output = XCompositeGetOverlayWindow (xdisplay, xroot); output = XCompositeGetOverlayWindow (xdisplay, xroot);
meta_core_add_old_event_mask (xdisplay, output, &mask);
XISetMask (mask.mask, XI_KeyPress); XISetMask (mask.mask, XI_KeyPress);
XISetMask (mask.mask, XI_KeyRelease); XISetMask (mask.mask, XI_KeyRelease);
XISetMask (mask.mask, XI_ButtonPress); XISetMask (mask.mask, XI_ButtonPress);
@ -550,6 +553,8 @@ meta_compositor_manage_screen (MetaCompositor *compositor,
XIEventMask mask = { XIAllMasterDevices, sizeof (mask_bits), mask_bits }; XIEventMask mask = { XIAllMasterDevices, sizeof (mask_bits), mask_bits };
XWindowAttributes attr; XWindowAttributes attr;
meta_core_add_old_event_mask (xdisplay, xwin, &mask);
XISetMask (mask.mask, XI_KeyPress); XISetMask (mask.mask, XI_KeyPress);
XISetMask (mask.mask, XI_KeyRelease); XISetMask (mask.mask, XI_KeyRelease);
XISetMask (mask.mask, XI_ButtonPress); XISetMask (mask.mask, XI_ButtonPress);

View File

@ -748,6 +748,8 @@ meta_screen_new (MetaDisplay *display,
XIEventMask mask = { XIAllMasterDevices, sizeof (mask_bits), mask_bits }; XIEventMask mask = { XIAllMasterDevices, sizeof (mask_bits), mask_bits };
XWindowAttributes attr; XWindowAttributes attr;
meta_core_add_old_event_mask (xdisplay, xroot, &mask);
XISetMask (mask.mask, XI_KeyPress); XISetMask (mask.mask, XI_KeyPress);
XISetMask (mask.mask, XI_KeyRelease); XISetMask (mask.mask, XI_KeyRelease);
XISetMask (mask.mask, XI_Enter); XISetMask (mask.mask, XI_Enter);

View File

@ -939,6 +939,8 @@ meta_window_new_with_attrs (MetaDisplay *display,
unsigned char mask_bits[XIMaskLen (XI_LASTEVENT)] = { 0 }; unsigned char mask_bits[XIMaskLen (XI_LASTEVENT)] = { 0 };
XIEventMask mask = { XIAllMasterDevices, sizeof (mask_bits), mask_bits }; 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_Enter);
XISetMask (mask.mask, XI_Leave); XISetMask (mask.mask, XI_Leave);
XISetMask (mask.mask, XI_FocusIn); XISetMask (mask.mask, XI_FocusIn);