From 8f533776803e8a573df5f6b02006bb0438856e78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= Date: Mon, 24 Jan 2022 18:55:20 +0100 Subject: [PATCH] gestures: fix disambiguation between two finger pinch and scroll MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/evdev-mt-touchpad-gestures.c | 7 +++++-- 1 file 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; }