summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosé Expósito <jose.exposito89@gmail.com>2022-01-24 18:55:20 +0100
committerJosé Expósito <jose.exposito89@gmail.com>2022-01-27 08:35:30 +0100
commit8f533776803e8a573df5f6b02006bb0438856e78 (patch)
treedac40af2cbeb0d1735540c3570ba727c6960b1b4
parente9aba30a783a3db61562a3319a41d8de579ba0ef (diff)
downloadlibinput-8f533776803e8a573df5f6b02006bb0438856e78.tar.gz
gestures: fix disambiguation between two finger pinch and scroll
The changes introduced in b5b6f835af2e99b6a4e64fb0174ab551ed141763 to add support for hold gestures introduced a regression: The mechanism that was in place to improve the disambiguation between two finger pinch and scroll during the beginning of the gesture stopped working and instead a bug warning was printed on the log. Fix the regression by allowing to go from the scroll state to the pinch state. Fix #726 Signed-off-by: José Expósito <jose.exposito89@gmail.com>
-rw-r--r--src/evdev-mt-touchpad-gestures.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/evdev-mt-touchpad-gestures.c b/src/evdev-mt-touchpad-gestures.c
index bf259423..08c93616 100644
--- a/src/evdev-mt-touchpad-gestures.c
+++ b/src/evdev-mt-touchpad-gestures.c
@@ -734,13 +734,17 @@ tp_gesture_handle_event_on_state_scroll(struct tp_dispatch *tp,
libinput_timer_cancel(&tp->gesture.hold_timer);
tp->gesture.state = GESTURE_STATE_NONE;
break;
+ case GESTURE_EVENT_PINCH:
+ tp_gesture_init_pinch(tp);
+ tp_gesture_cancel(tp, time);
+ tp->gesture.state = GESTURE_STATE_PINCH;
+ break;
case GESTURE_EVENT_HOLD_AND_MOTION:
case GESTURE_EVENT_FINGER_DETECTED:
case GESTURE_EVENT_HOLD_TIMEOUT:
case GESTURE_EVENT_POINTER_MOTION:
case GESTURE_EVENT_SCROLL:
case GESTURE_EVENT_SWIPE:
- case GESTURE_EVENT_PINCH:
log_gesture_bug(tp, event);
break;
}
@@ -1166,7 +1170,6 @@ tp_gesture_handle_state_scroll(struct tp_dispatch *tp, uint64_t time)
*/
if (time < (tp->gesture.initial_time + DEFAULT_GESTURE_PINCH_TIMEOUT) &&
tp_gesture_is_pinch(tp)) {
- tp_gesture_cancel(tp, time);
tp_gesture_handle_event(tp, GESTURE_EVENT_PINCH, time);
return;
}