From 9f6ea433ae452b67ed7c58178248e765b673e748 Mon Sep 17 00:00:00 2001 From: Rui Matos Date: Sat, 6 Oct 2012 01:39:41 +0200 Subject: 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 --- plugins/mouse/msd-locate-pointer.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) 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; } -- cgit v1.2.1