gestures: fix disambiguation between two finger pinch and scroll

The changes introduced in b5b6f835af 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>
This commit is contained in:
José Expósito 2022-01-24 18:55:20 +01:00
parent e9aba30a78
commit 8f53377680

View file

@ -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;
}