Skip to content

Commit

Permalink
mouse: Also grab button presses so as to replay them on pointer locater
Browse files Browse the repository at this point in the history
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
  • Loading branch information
rtcm authored and XRevan86 committed Mar 18, 2017
1 parent 889f0f2 commit 3e29515
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions plugins/mouse/msd-locate-pointer.c
Expand Up @@ -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);
Expand All @@ -494,17 +498,43 @@ 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
{
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;
}
Expand Down

0 comments on commit 3e29515

Please sign in to comment.