diff options
author | Rui Matos <[email protected]> | 2012-10-06 01:39:41 +0200 |
---|---|---|
committer | Alexei Sorokin <[email protected]> | 2017-03-18 22:17:36 +0300 |
commit | 9f6ea433ae452b67ed7c58178248e765b673e748 (patch) | |
tree | 78ee1afe409ea9b37bb12e3bed59ef10b4b6e44d /plugins | |
parent | 853cc71a92cb5e931f2a85b58cf6f3e2ba6bc2c2 (diff) | |
download | mate-settings-daemon-9f6ea433ae452b67ed7c58178248e765b673e748.tar.bz2 mate-settings-daemon-9f6ea433ae452b67ed7c58178248e765b673e748.tar.xz |
mouse: Also grab button presses so as to replay them on pointer locater
Applications might want to establish keyboard grabs on button presses so we
should also ungrab the keyboard when a button press occurs after the locate
pointer key is pressed.
https://bugzilla.gnome.org/show_bug.cgi?id=125618
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mouse/msd-locate-pointer.c | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/plugins/mouse/msd-locate-pointer.c b/plugins/mouse/msd-locate-pointer.c index 468d840..c6ba14a 100644 --- a/plugins/mouse/msd-locate-pointer.c +++ b/plugins/mouse/msd-locate-pointer.c @@ -646,9 +646,23 @@ filter (GdkXEvent *xevent, XAllowEvents (xev->xkey.display, SyncKeyboard, xev->xkey.time); + XGrabButton (xev->xkey.display, + AnyButton, + AnyModifier, + xev->xkey.window, + False, + ButtonPressMask, + GrabModeSync, + GrabModeAsync, + None, + None); } else { + XUngrabButton (xev->xkey.display, + AnyButton, + AnyModifier, + xev->xkey.window); XAllowEvents (xev->xkey.display, AsyncKeyboard, xev->xkey.time); @@ -660,10 +674,26 @@ filter (GdkXEvent *xevent, XAllowEvents (xev->xkey.display, ReplayKeyboard, xev->xkey.time); - XUngrabKeyboard (GDK_DISPLAY_XDISPLAY (display), + XUngrabButton (xev->xkey.display, + AnyButton, + AnyModifier, + xev->xkey.window); + XUngrabKeyboard (xev->xkey.display, xev->xkey.time); } } + else if (xev->type == ButtonPress) + { + XAllowEvents (xev->xbutton.display, + ReplayPointer, + xev->xbutton.time); + XUngrabButton (xev->xbutton.display, + AnyButton, + AnyModifier, + xev->xbutton.window); + XUngrabKeyboard (xev->xbutton.display, + xev->xbutton.time); + } return GDK_FILTER_CONTINUE; } |