mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-20 06:50:05 +01:00
touchpad: fix tapping that happens after a moving thumb
When finger movement exceeded the motion threshold before the finger was recognized as a thumb, it would never be regarded as a thumb by the tap system. This prohibited tapping until the thumb was lifted. This is fixed by moving the check for the thumb state up such that it happens before the motion threshold check. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
cdebfc78ff
commit
af86152370
2 changed files with 43 additions and 4 deletions
|
|
@ -1039,6 +1039,9 @@ tp_tap_handle_state(struct tp_dispatch *tp, uint64_t time)
|
||||||
tp_tap_handle_event(tp, t, TAP_EVENT_RELEASE, time);
|
tp_tap_handle_event(tp, t, TAP_EVENT_RELEASE, time);
|
||||||
}
|
}
|
||||||
t->tap.state = TAP_TOUCH_STATE_IDLE;
|
t->tap.state = TAP_TOUCH_STATE_IDLE;
|
||||||
|
} else if (tp->tap.state != TAP_STATE_IDLE &&
|
||||||
|
t->thumb.state == THUMB_STATE_YES) {
|
||||||
|
tp_tap_handle_event(tp, t, TAP_EVENT_THUMB, time);
|
||||||
} else if (tp->tap.state != TAP_STATE_IDLE &&
|
} else if (tp->tap.state != TAP_STATE_IDLE &&
|
||||||
tp_tap_exceeds_motion_threshold(tp, t)) {
|
tp_tap_exceeds_motion_threshold(tp, t)) {
|
||||||
struct tp_touch *tmp;
|
struct tp_touch *tmp;
|
||||||
|
|
@ -1051,10 +1054,6 @@ tp_tap_handle_state(struct tp_dispatch *tp, uint64_t time)
|
||||||
}
|
}
|
||||||
|
|
||||||
tp_tap_handle_event(tp, t, TAP_EVENT_MOTION, time);
|
tp_tap_handle_event(tp, t, TAP_EVENT_MOTION, time);
|
||||||
} else if (tp->tap.state != TAP_STATE_IDLE &&
|
|
||||||
t->thumb.state == THUMB_STATE_YES &&
|
|
||||||
!t->tap.is_thumb) {
|
|
||||||
tp_tap_handle_event(tp, t, TAP_EVENT_THUMB, time);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4974,6 +4974,45 @@ START_TEST(touchpad_thumb_tap_hold_2ndfg_tap)
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
START_TEST(touchpad_thumb_move_and_tap)
|
||||||
|
{
|
||||||
|
struct litest_device *dev = litest_current_device();
|
||||||
|
struct libinput *li = dev->libinput;
|
||||||
|
struct axis_replacement axes[] = {
|
||||||
|
{ ABS_MT_PRESSURE, 75 },
|
||||||
|
{ -1, 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!has_thumb_detect(dev))
|
||||||
|
return;
|
||||||
|
|
||||||
|
litest_enable_tap(dev->libinput_device);
|
||||||
|
litest_drain_events(li);
|
||||||
|
|
||||||
|
/* trigger thumb detection by pressure after a slight movement */
|
||||||
|
litest_touch_down(dev, 0, 50, 99);
|
||||||
|
litest_touch_move(dev, 0, 51, 99);
|
||||||
|
litest_touch_move_extended(dev, 0, 55, 99, axes);
|
||||||
|
libinput_dispatch(li);
|
||||||
|
|
||||||
|
litest_assert_empty_queue(li);
|
||||||
|
|
||||||
|
/* thumb is resting, check if tapping still works */
|
||||||
|
litest_touch_down(dev, 1, 50, 50);
|
||||||
|
litest_touch_up(dev, 1);
|
||||||
|
libinput_dispatch(li);
|
||||||
|
litest_timeout_tap();
|
||||||
|
|
||||||
|
litest_assert_button_event(li,
|
||||||
|
BTN_LEFT,
|
||||||
|
LIBINPUT_BUTTON_STATE_PRESSED);
|
||||||
|
litest_assert_button_event(li,
|
||||||
|
BTN_LEFT,
|
||||||
|
LIBINPUT_BUTTON_STATE_RELEASED);
|
||||||
|
litest_assert_empty_queue(li);
|
||||||
|
}
|
||||||
|
END_TEST
|
||||||
|
|
||||||
START_TEST(touchpad_tool_tripletap_touch_count)
|
START_TEST(touchpad_tool_tripletap_touch_count)
|
||||||
{
|
{
|
||||||
struct litest_device *dev = litest_current_device();
|
struct litest_device *dev = litest_current_device();
|
||||||
|
|
@ -6081,6 +6120,7 @@ TEST_COLLECTION(touchpad)
|
||||||
litest_add("touchpad:thumb", touchpad_thumb_tap_hold, LITEST_CLICKPAD, LITEST_ANY);
|
litest_add("touchpad:thumb", touchpad_thumb_tap_hold, LITEST_CLICKPAD, LITEST_ANY);
|
||||||
litest_add("touchpad:thumb", touchpad_thumb_tap_hold_2ndfg, LITEST_CLICKPAD, LITEST_SINGLE_TOUCH);
|
litest_add("touchpad:thumb", touchpad_thumb_tap_hold_2ndfg, LITEST_CLICKPAD, LITEST_SINGLE_TOUCH);
|
||||||
litest_add("touchpad:thumb", touchpad_thumb_tap_hold_2ndfg_tap, LITEST_CLICKPAD, LITEST_SINGLE_TOUCH);
|
litest_add("touchpad:thumb", touchpad_thumb_tap_hold_2ndfg_tap, LITEST_CLICKPAD, LITEST_SINGLE_TOUCH);
|
||||||
|
litest_add("touchpad:thumb", touchpad_thumb_move_and_tap, LITEST_CLICKPAD, LITEST_ANY);
|
||||||
|
|
||||||
litest_add_for_device("touchpad:bugs", touchpad_tool_tripletap_touch_count, LITEST_SYNAPTICS_TOPBUTTONPAD);
|
litest_add_for_device("touchpad:bugs", touchpad_tool_tripletap_touch_count, LITEST_SYNAPTICS_TOPBUTTONPAD);
|
||||||
litest_add_for_device("touchpad:bugs", touchpad_slot_swap, LITEST_SYNAPTICS_TOPBUTTONPAD);
|
litest_add_for_device("touchpad:bugs", touchpad_slot_swap, LITEST_SYNAPTICS_TOPBUTTONPAD);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue