diff --git a/doc/touchpad-tap-state-machine.svg b/doc/touchpad-tap-state-machine.svg
index d4630c1f..4d6f64e6 100644
--- a/doc/touchpad-tap-state-machine.svg
+++ b/doc/touchpad-tap-state-machine.svg
@@ -1,3 +1,3 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/src/evdev-mt-touchpad-tap.c b/src/evdev-mt-touchpad-tap.c
index 7077715b..0db0c626 100644
--- a/src/evdev-mt-touchpad-tap.c
+++ b/src/evdev-mt-touchpad-tap.c
@@ -429,13 +429,6 @@ tp_drag_dragging_handle_event(struct tp_dispatch *tp,
switch (event) {
case TAP_EVENT_TOUCH:
- if (tp->tap.nfingers_down > 2) {
- tp_tap_notify(tp,
- time,
- nfingers_tapped,
- LIBINPUT_BUTTON_STATE_RELEASED);
- tp->tap.drag_state = DRAG_STATE_IDLE;
- }
break;
case TAP_EVENT_RELEASE:
if (tp->tap.nfingers_down == 0) {
@@ -1027,7 +1020,10 @@ tp_tap_touch3_handle_event(struct tp_dispatch *tp,
tp_tap_move_to_dead(tp, t);
break;
case TAP_EVENT_TIMEOUT:
- tp->tap.state = TAP_STATE_TOUCH_3_HOLD;
+ if (tp->tap.drag_state == DRAG_STATE_IDLE)
+ tp->tap.state = TAP_STATE_TOUCH_3_HOLD;
+ else
+ tp->tap.state = TAP_STATE_DEAD;
tp_tap_clear_timer(tp);
tp_gesture_tap_timeout(tp, time);
break;
@@ -1115,7 +1111,10 @@ tp_tap_touch3_release_handle_event(struct tp_dispatch *tp,
break;
case TAP_EVENT_TIMEOUT:
tp_drag_handle_event(tp, t, TAP_EVENT_3FGTAP, time);
- tp->tap.state = TAP_STATE_TOUCH_2_HOLD;
+ if (tp->tap.drag_state == DRAG_STATE_IDLE)
+ tp->tap.state = TAP_STATE_TOUCH_2_HOLD;
+ else
+ tp->tap.state = TAP_STATE_DEAD;
break;
case TAP_EVENT_BUTTON:
tp_drag_handle_event(tp, t, TAP_EVENT_3FGTAP, time);
@@ -1160,7 +1159,10 @@ tp_tap_touch3_release2_handle_event(struct tp_dispatch *tp,
break;
case TAP_EVENT_TIMEOUT:
tp_drag_handle_event(tp, t, TAP_EVENT_3FGTAP, time);
- tp->tap.state = TAP_STATE_HOLD;
+ if (tp->tap.drag_state == DRAG_STATE_IDLE)
+ tp->tap.state = TAP_STATE_HOLD;
+ else
+ tp->tap.state = TAP_STATE_DEAD;
break;
case TAP_EVENT_BUTTON:
tp_drag_handle_event(tp, t, TAP_EVENT_3FGTAP, time);
diff --git a/test/test-touchpad-tap.c b/test/test-touchpad-tap.c
index 8536fbeb..9914ac21 100644
--- a/test/test-touchpad-tap.c
+++ b/test/test-touchpad-tap.c
@@ -1975,22 +1975,23 @@ START_TEST(touchpad_tap_n_drag_3fg_btntool)
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
- /* Putting down a third finger should end the drag */
+ /* Putting down a third finger should not cause any events */
litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1);
litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0);
litest_event(dev, EV_SYN, SYN_REPORT, 0);
litest_dispatch(li);
- litest_assert_button_event(li, button,
- LIBINPUT_BUTTON_STATE_RELEASED);
+ litest_assert_empty_queue(li);
- /* Releasing the fingers should not cause any events */
+ /* Releasing the fingers should end the drag */
litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 0);
litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 1);
litest_event(dev, EV_SYN, SYN_REPORT, 0);
litest_touch_up(dev, 1);
litest_touch_up(dev, 0);
+ litest_assert_button_event(li, button,
+ LIBINPUT_BUTTON_STATE_RELEASED);
litest_assert_empty_queue(li);
}
END_TEST
@@ -2069,19 +2070,20 @@ START_TEST(touchpad_tap_n_drag_3fg)
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
- /* Putting down a third finger should end the drag */
+ /* Putting down a third finger should still do nothing */
litest_touch_down(dev, 2, 50, 50);
litest_dispatch(li);
- litest_assert_button_event(li, button,
- LIBINPUT_BUTTON_STATE_RELEASED);
+ litest_assert_empty_queue(li);
- /* Releasing the fingers should not cause any events */
+ /* Releasing the fingers should end the drag */
litest_touch_up(dev, 2);
litest_touch_up(dev, 1);
litest_touch_up(dev, 0);
+ litest_assert_button_event(li, button,
+ LIBINPUT_BUTTON_STATE_RELEASED);
litest_assert_empty_queue(li);
}
END_TEST