From 3e295156e3bd77007984dedf8d326b6c412ff925 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 | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'plugins/mouse') diff --git a/plugins/mouse/msd-locate-pointer.c b/plugins/mouse/msd-locate-pointer.c index b2ccbf0..2077ca4 100644 --- a/plugins/mouse/msd-locate-pointer.c +++ b/plugins/mouse/msd-locate-pointer.c @@ -484,6 +484,10 @@ event_filter (GdkXEvent *gdkxevent, { if (xevent->xany.type == KeyRelease) { + XUngrabButton (xevent->xany.display, + AnyButton, + AnyModifier, + xevent->xany.window); XAllowEvents (xevent->xany.display, AsyncKeyboard, xevent->xkey.time); @@ -494,6 +498,16 @@ event_filter (GdkXEvent *gdkxevent, XAllowEvents (xevent->xany.display, SyncKeyboard, xevent->xkey.time); + XGrabButton (xevent->xany.display, + AnyButton, + AnyModifier, + xevent->xany.window, + False, + ButtonPressMask, + GrabModeSync, + GrabModeAsync, + None, + None); } } else @@ -501,10 +515,26 @@ event_filter (GdkXEvent *gdkxevent, XAllowEvents (xevent->xany.display, ReplayKeyboard, xevent->xkey.time); + XUngrabButton (xevent->xany.display, + AnyButton, + AnyModifier, + xevent->xany.window); XUngrabKeyboard (xevent->xany.display, xevent->xkey.time); } } + else if (xevent->xany.type == ButtonPress) + { + XAllowEvents (xevent->xany.display, + ReplayPointer, + xevent->xbutton.time); + XUngrabButton (xevent->xany.display, + AnyButton, + AnyModifier, + xevent->xany.window); + XUngrabKeyboard (xevent->xany.display, + xevent->xbutton.time); + } return GDK_FILTER_CONTINUE; } -- cgit v1.2.1