summaryrefslogtreecommitdiff
path: root/plugins/mouse
diff options
context:
space:
mode:
authorRui Matos <[email protected]>2012-10-06 01:39:41 +0200
committerAlexei Sorokin <[email protected]>2017-03-18 22:17:36 +0300
commit3e295156e3bd77007984dedf8d326b6c412ff925 (patch)
tree459db95d2f96cf08bfe41c5022acc06c9e513a25 /plugins/mouse
parent889f0f2336640314d966dfe9c02d74169c255d5c (diff)
downloadmate-settings-daemon-3e295156e3bd77007984dedf8d326b6c412ff925.tar.bz2
mate-settings-daemon-3e295156e3bd77007984dedf8d326b6c412ff925.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/mouse')
-rw-r--r--plugins/mouse/msd-locate-pointer.c30
1 files changed, 30 insertions, 0 deletions
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;
}