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
This commit is contained in:
Jasper St. Pierre 2012-12-21 06:49:38 -05:00
parent 034ab77c30
commit b0774d795c

View File

@ -581,7 +581,10 @@ reload_monitor_infos (MetaScreen *screen)
/* The guard window allows us to leave minimized windows mapped so /* The guard window allows us to leave minimized windows mapped so
* that compositor code may provide live previews of them. * that compositor code may provide live previews of them.
* Instead of being unmapped/withdrawn, they get pushed underneath * 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 static Window
create_guard_window (Display *xdisplay, MetaScreen *screen) create_guard_window (Display *xdisplay, MetaScreen *screen)
{ {
@ -609,6 +612,17 @@ create_guard_window (Display *xdisplay, MetaScreen *screen)
CopyFromParent, /* visual */ CopyFromParent, /* visual */
CWEventMask|CWOverrideRedirect|CWBackPixel, CWEventMask|CWOverrideRedirect|CWBackPixel,
&attributes); &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, meta_stack_tracker_record_add (screen->stack_tracker,
guard_window, guard_window,
create_serial); create_serial);