From b0774d795c511f87f2a089edc2246a86fa8cb3fc Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Fri, 21 Dec 2012 06:49:38 -0500 Subject: [PATCH] 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 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/core/screen.c b/src/core/screen.c index 46c5e3ab6..076bf68d5 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);