[mutter] screen: Select for pointer events on the guard window



commit b0774d795c511f87f2a089edc2246a86fa8cb3fc
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Fri Dec 21 06:49:38 2012 -0500

    screen: Select for pointer events on the guard window
    
    The guard window is effectively the background window, as it sits
    in between live windows and minimized windows. This gives us a nice
    easy place to allow users to allow users to right-click or long-press
    on the wallpaper.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=681540

 src/core/screen.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/src/core/screen.c b/src/core/screen.c
index 46c5e3a..076bf68 100644
--- a/src/core/screen.c
+++ b/src/core/screen.c
@@ -581,7 +581,10 @@ reload_monitor_infos (MetaScreen *screen)
 /* The guard window allows us to leave minimized windows mapped so
  * that compositor code may provide live previews of them.
  * Instead of being unmapped/withdrawn, they get pushed underneath
- * the guard window. */
+ * the guard window. We also select events on the guard window, which
+ * should effectively be forwarded to events on the background actor,
+ * providing that the scene graph is set up correctly.
+ */
 static Window
 create_guard_window (Display *xdisplay, MetaScreen *screen)
 {
@@ -609,6 +612,17 @@ create_guard_window (Display *xdisplay, MetaScreen *screen)
                   CopyFromParent, /* visual */
                   CWEventMask|CWOverrideRedirect|CWBackPixel,
                   &attributes);
+
+  {
+    unsigned char mask_bits[XIMaskLen (XI_LASTEVENT)] = { 0 };
+    XIEventMask mask = { XIAllMasterDevices, sizeof (mask_bits), mask_bits };
+
+    XISetMask (mask.mask, XI_ButtonPress);
+    XISetMask (mask.mask, XI_ButtonRelease);
+    XISetMask (mask.mask, XI_Motion);
+    XISelectEvents (xdisplay, guard_window, &mask, 1);
+  }
+
   meta_stack_tracker_record_add (screen->stack_tracker,
                                  guard_window,
                                  create_serial);


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