Touchpad: Gesture states fall through in tp_gesture_post_gesture
This was the source of some scrolls starting before getting a chance to initialize (see #101 (closed)). In evdev-mt-touchpad-gestures.c:480
:
static void
tp_gesture_post_gesture(struct tp_dispatch *tp, uint64_t time)
{
enum tp_gesture_state oldstate = tp->gesture.state;
if (tp->gesture.state == GESTURE_STATE_NONE)
tp->gesture.state =
tp_gesture_handle_state_none(tp, time);
if (tp->gesture.state == GESTURE_STATE_UNKNOWN)
tp->gesture.state =
tp_gesture_handle_state_unknown(tp, time);
if (tp->gesture.state == GESTURE_STATE_SCROLL)
tp->gesture.state =
tp_gesture_handle_state_scroll(tp, time);
...
Because the if
statements "fall through" from one handle_state function to the next, the first few frames of a some scroll motions were sometimes being handled (in one post) as multiple gesture states (NONE -> UNKNOWN -> SCROLL), thus triggering a few frames of scrolling before tp_gesture_start()
.
Theoretically this can happen with the swipe and pinch states too. Is this intentional (for quicker response perhaps), or should this be changed to a switch
/case
block?