summaryrefslogtreecommitdiff
path: root/gdk/gdkseatdefault.c
diff options
context:
space:
mode:
authorDaniel Boles <dboles@src.gnome.org>2017-09-05 15:44:00 +0100
committerDaniel Boles <dboles@src.gnome.org>2017-09-20 19:19:35 +0100
commit9c7e996bceaecedd474481d00303d807dcd5410c (patch)
tree29e3bab751264a5936207bfe8ad1b80a41877816 /gdk/gdkseatdefault.c
parent761194dad7e532cabc627c35a38b80af015797b8 (diff)
downloadgtk+-9c7e996bceaecedd474481d00303d807dcd5410c.tar.gz
gdkseatdefault: Grab touch events where applicable
gdk_seat_default_grab() grabs POINTER_EVENTS if the capability is GDK_SEAT_CAPABILITY_ALL_POINTING. But that enumerator is a union that includes GDK_SEAT_CAPABILITY_TOUCH, but we never grabbed TOUCH_EVENTS, an unused macro that was presumably created with this purpose in mind. So, check which of the ALL_POINTING capabilities we have, and set the right mask of POINTER_EVENTS and/or TOUCH_EVENTS as required. As part of this, explicitly let TABLET_STYLUS take over pointer events, as this is the intended behaviour and was the effective result before. This should fix touch events being lost in migrating from Device.grab() to Seat.grab(GDK_SEAT_CAPABILITY_ALL_POINTING), as found by Inkscape. https://bugzilla.gnome.org/show_bug.cgi?id=781757
Diffstat (limited to 'gdk/gdkseatdefault.c')
-rw-r--r--gdk/gdkseatdefault.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/gdk/gdkseatdefault.c b/gdk/gdkseatdefault.c
index dc3f2887d3..91a42cd4af 100644
--- a/gdk/gdkseatdefault.c
+++ b/gdk/gdkseatdefault.c
@@ -132,9 +132,22 @@ gdk_seat_default_grab (GdkSeat *seat,
if (capabilities & GDK_SEAT_CAPABILITY_ALL_POINTING)
{
+ /* ALL_POINTING spans 3 capabilities; get the mask for the ones we have */
+ GdkEventMask pointer_evmask = 0;
+
+ /* We let tablet styli take over the pointer cursor */
+ if (capabilities & (GDK_SEAT_CAPABILITY_POINTER |
+ GDK_SEAT_CAPABILITY_TABLET_STYLUS))
+ {
+ pointer_evmask |= POINTER_EVENTS;
+ }
+
+ if (capabilities & GDK_SEAT_CAPABILITY_TOUCH)
+ pointer_evmask |= TOUCH_EVENTS;
+
status = gdk_device_grab (priv->master_pointer, window,
GDK_OWNERSHIP_NONE, owner_events,
- POINTER_EVENTS, cursor,
+ pointer_evmask, cursor,
evtime);
}