[mutter/wip/barriers-try-2: 1/8] Select for XI2 events everywhere else
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/barriers-try-2: 1/8] Select for XI2 events everywhere else
- Date: Mon, 26 Nov 2012 01:40:04 +0000 (UTC)
commit 4f198393a1cb7a5aec98983c28450cf76d3dd8ed
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Tue Nov 20 20:15:09 2012 -0500
Select for XI2 events everywhere else
In random places that are not grabs, we selected for events on
things like the root window, stage window, COW and more. Switch
these over to using the proper XI2 APIs.
https://bugzilla.gnome.org/show_bug.cgi?id=688779
src/compositor/compositor.c | 67 ++++++++++++++++++++++++------------------
src/core/screen.c | 34 ++++++++++++++++------
src/core/window.c | 16 ++++++++--
3 files changed, 76 insertions(+), 41 deletions(-)
---
diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c
index 9c86e03..db57d37 100644
--- a/src/compositor/compositor.c
+++ b/src/compositor/compositor.c
@@ -158,23 +158,26 @@ get_output_window (MetaScreen *screen)
Window output, xroot;
XWindowAttributes attr;
long event_mask;
+ unsigned char mask_bits[XIMaskLen (XI_LASTEVENT)] = { 0 };
+ XIEventMask mask = { XIAllMasterDevices, sizeof (mask_bits), mask_bits };
xroot = meta_screen_get_xroot (screen);
-
- event_mask = FocusChangeMask |
- ExposureMask |
- EnterWindowMask | LeaveWindowMask |
- PointerMotionMask |
- PropertyChangeMask |
- ButtonPressMask | ButtonReleaseMask |
- KeyPressMask | KeyReleaseMask;
-
output = XCompositeGetOverlayWindow (xdisplay, xroot);
+ XISetMask (mask.mask, XI_KeyPress);
+ XISetMask (mask.mask, XI_KeyRelease);
+ XISetMask (mask.mask, XI_ButtonPress);
+ XISetMask (mask.mask, XI_ButtonRelease);
+ XISetMask (mask.mask, XI_Enter);
+ XISetMask (mask.mask, XI_Leave);
+ XISetMask (mask.mask, XI_FocusIn);
+ XISetMask (mask.mask, XI_FocusOut);
+ XISetMask (mask.mask, XI_Motion);
+ XISelectEvents (xdisplay, output, &mask, 1);
+
+ event_mask = ExposureMask | PropertyChangeMask;
if (XGetWindowAttributes (xdisplay, output, &attr))
- {
- event_mask |= attr.your_event_mask;
- }
+ event_mask |= attr.your_event_mask;
XSelectInput (xdisplay, output, event_mask);
@@ -476,8 +479,6 @@ meta_compositor_manage_screen (MetaCompositor *compositor,
Window xroot = meta_screen_get_xroot (screen);
Window xwin;
gint width, height;
- XWindowAttributes attr;
- long event_mask;
guint n_retries;
guint max_retries;
@@ -544,21 +545,29 @@ meta_compositor_manage_screen (MetaCompositor *compositor,
XResizeWindow (xdisplay, xwin, width, height);
- event_mask = FocusChangeMask |
- ExposureMask |
- EnterWindowMask | LeaveWindowMask |
- PointerMotionMask |
- PropertyChangeMask |
- ButtonPressMask | ButtonReleaseMask |
- KeyPressMask | KeyReleaseMask |
- StructureNotifyMask;
-
- if (XGetWindowAttributes (xdisplay, xwin, &attr))
- {
- event_mask |= attr.your_event_mask;
- }
-
- XSelectInput (xdisplay, xwin, event_mask);
+ {
+ long event_mask;
+ unsigned char mask_bits[XIMaskLen (XI_LASTEVENT)] = { 0 };
+ XIEventMask mask = { XIAllMasterDevices, sizeof (mask_bits), mask_bits };
+ XWindowAttributes attr;
+
+ XISetMask (mask.mask, XI_KeyPress);
+ XISetMask (mask.mask, XI_KeyRelease);
+ XISetMask (mask.mask, XI_ButtonPress);
+ XISetMask (mask.mask, XI_ButtonRelease);
+ XISetMask (mask.mask, XI_Enter);
+ XISetMask (mask.mask, XI_Leave);
+ XISetMask (mask.mask, XI_FocusIn);
+ XISetMask (mask.mask, XI_FocusOut);
+ XISetMask (mask.mask, XI_Motion);
+ XISelectEvents (xdisplay, xwin, &mask, 1);
+
+ event_mask = ExposureMask | PropertyChangeMask | StructureNotifyMask;
+ if (XGetWindowAttributes (xdisplay, xwin, &attr))
+ event_mask |= attr.your_event_mask;
+
+ XSelectInput (xdisplay, xwin, event_mask);
+ }
info->window_group = meta_window_group_new (screen);
info->background_actor = meta_background_actor_new_for_screen (screen);
diff --git a/src/core/screen.c b/src/core/screen.c
index 03adfef..afc567f 100644
--- a/src/core/screen.c
+++ b/src/core/screen.c
@@ -736,15 +736,31 @@ meta_screen_new (MetaDisplay *display,
/* We need to or with the existing event mask since
* gtk+ may be interested in other events.
*/
- XGetWindowAttributes (xdisplay, xroot, &attr);
- XSelectInput (xdisplay,
- xroot,
- SubstructureRedirectMask | SubstructureNotifyMask |
- ColormapChangeMask | PropertyChangeMask |
- LeaveWindowMask | EnterWindowMask |
- KeyPressMask | KeyReleaseMask |
- FocusChangeMask | StructureNotifyMask |
- ExposureMask | attr.your_event_mask);
+ {
+ long event_mask;
+ unsigned char mask_bits[XIMaskLen (XI_LASTEVENT)] = { 0 };
+ XIEventMask mask = { XIAllMasterDevices, sizeof (mask_bits), mask_bits };
+ XWindowAttributes attr;
+
+ XISetMask (mask.mask, XI_KeyPress);
+ XISetMask (mask.mask, XI_KeyRelease);
+ XISetMask (mask.mask, XI_ButtonPress);
+ XISetMask (mask.mask, XI_ButtonRelease);
+ XISetMask (mask.mask, XI_Enter);
+ XISetMask (mask.mask, XI_Leave);
+ XISetMask (mask.mask, XI_FocusIn);
+ XISetMask (mask.mask, XI_FocusOut);
+ XISetMask (mask.mask, XI_Motion);
+ XISelectEvents (xdisplay, xroot, &mask, 1);
+
+ event_mask = (SubstructureRedirectMask | SubstructureNotifyMask |
+ StructureNotifyMask | ColormapChangeMask | PropertyChangeMask);
+ if (XGetWindowAttributes (xdisplay, xroot, &attr))
+ event_mask |= attr.your_event_mask;
+
+ XSelectInput (xdisplay, xroot, event_mask);
+ }
+
if (meta_error_trap_pop_with_return (display) != Success)
{
meta_warning (_("Screen %d on display \"%s\" already has a window manager\n"),
diff --git a/src/core/window.c b/src/core/window.c
index 0e28fd0..9084e54 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -922,9 +922,7 @@ meta_window_new_with_attrs (MetaDisplay *display,
XAddToSaveSet (display->xdisplay, xwindow);
meta_error_trap_pop_with_return (display);
- event_mask =
- PropertyChangeMask | EnterWindowMask | LeaveWindowMask |
- FocusChangeMask | ColormapChangeMask;
+ event_mask = PropertyChangeMask | ColormapChangeMask;
if (attrs->override_redirect)
event_mask |= StructureNotifyMask;
@@ -934,6 +932,18 @@ meta_window_new_with_attrs (MetaDisplay *display,
*/
XSelectInput (display->xdisplay, xwindow, attrs->your_event_mask | event_mask);
+ {
+ unsigned char mask_bits[XIMaskLen (XI_LASTEVENT)] = { 0 };
+ XIEventMask mask = { XIAllMasterDevices, sizeof (mask_bits), mask_bits };
+
+ XISetMask (mask.mask, XI_Enter);
+ XISetMask (mask.mask, XI_Leave);
+ XISetMask (mask.mask, XI_FocusIn);
+ XISetMask (mask.mask, XI_FocusOut);
+
+ XISelectEvents (display->xdisplay, xwindow, &mask, 1);
+ }
+
has_shape = FALSE;
#ifdef HAVE_SHAPE
if (META_DISPLAY_HAS_SHAPE (display))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]