Skip to content

Commit cf784bf

Browse files
committed
TouchpadBackend: Make sure we don't steal gestures from other instances
If we managed to register our captured event handler before another instance it can happen that we steal the gesture from the other instance. E.g. the user clearly swipes horizontal but once they swiped long enough they drifted over the vertical threshold and we will start stealing the gesture.
1 parent 8072858 commit cf784bf

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/Gestures/TouchpadBackend.vala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,14 @@ private class Gala.TouchpadBackend : Object, GestureBackend {
7474
event.get_gesture_motion_delta_unaccelerated (out delta_x, out delta_y);
7575

7676
if (state != ONGOING) {
77+
foreach (var instance in instances) {
78+
if (instance != this && (instance.group == NONE || instance.group != group) && instance.state == ONGOING) {
79+
/* Another instance is already recognizing this gesture, make sure we don't steal it */
80+
state = IGNORED;
81+
return Clutter.EVENT_PROPAGATE;
82+
}
83+
}
84+
7785
distance_x += delta_x;
7886
distance_y += delta_y;
7987

0 commit comments

Comments
 (0)