mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-26 11:00:06 +01:00
touchpad: ignore any semi-mt movement in the same frame as a finger release
Semi-MT devices provide a bounding box of the fingers, and internally we don't treat them as real MT device. Depending which finger currently provides ABS_X/Y we may get a large jump when the other finger is released. Basic sequence is finger 1 down, finger 2 down, finger 1 up. On the last interaction, the ABS_X/Y which was on finger 1's coordinates now jumps to finger 2's coordinates. This is interpreted as movement by the tapping code, resulting in missed two-finger taps. Ignore these movements on semi-mt devices. https://bugs.freedesktop.org/show_bug.cgi?id=105043 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
cfa921250d
commit
80c3a100de
2 changed files with 39 additions and 0 deletions
|
|
@ -942,6 +942,13 @@ tp_tap_exceeds_motion_threshold(struct tp_dispatch *tp,
|
|||
return false;
|
||||
}
|
||||
|
||||
/* Semi-mt devices will give us large movements on finger release,
|
||||
* depending which touch is released. Make sure we ignore any
|
||||
* movement in the same frame as a finger change.
|
||||
*/
|
||||
if (tp->semi_mt && tp->nfingers_down != tp->old_nfingers_down)
|
||||
return false;
|
||||
|
||||
return length_in_mm(mm) > DEFAULT_TAP_MOVE_THRESHOLD;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1073,6 +1073,37 @@ START_TEST(touchpad_2fg_tap_inverted)
|
|||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(touchpad_2fg_tap_move_on_release)
|
||||
{
|
||||
struct litest_device *dev = litest_current_device();
|
||||
struct libinput *li = dev->libinput;
|
||||
|
||||
litest_enable_tap(dev->libinput_device);
|
||||
litest_drain_events(dev->libinput);
|
||||
|
||||
litest_touch_down(dev, 0, 50, 50);
|
||||
litest_touch_down(dev, 1, 70, 70);
|
||||
|
||||
litest_push_event_frame(dev);
|
||||
litest_touch_move(dev, 0, 55, 55);
|
||||
litest_touch_up(dev, 1);
|
||||
litest_pop_event_frame(dev);
|
||||
|
||||
litest_touch_up(dev, 0);
|
||||
|
||||
libinput_dispatch(li);
|
||||
|
||||
litest_assert_button_event(li,
|
||||
BTN_RIGHT,
|
||||
LIBINPUT_BUTTON_STATE_PRESSED);
|
||||
litest_assert_button_event(li,
|
||||
BTN_RIGHT,
|
||||
LIBINPUT_BUTTON_STATE_RELEASED);
|
||||
|
||||
litest_assert_empty_queue(li);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(touchpad_2fg_tap_n_hold_first)
|
||||
{
|
||||
struct litest_device *dev = litest_current_device();
|
||||
|
|
@ -3402,6 +3433,7 @@ TEST_COLLECTION(touchpad_tap)
|
|||
litest_add("tap-2fg:2fg", touchpad_2fg_tap_n_drag_3fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
|
||||
litest_add_ranged("tap-2fg:2fg", touchpad_2fg_tap, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT, &tap_map_range);
|
||||
litest_add_ranged("tap-2fg:2fg", touchpad_2fg_tap_inverted, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &tap_map_range);
|
||||
litest_add("tap-2fg:2fg", touchpad_2fg_tap_move_on_release, LITEST_TOUCHPAD|LITEST_SEMI_MT, LITEST_SINGLE_TOUCH);
|
||||
litest_add("tap-2fg:2fg", touchpad_2fg_tap_n_hold_first, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
|
||||
litest_add("tap-2fg:2fg", touchpad_2fg_tap_n_hold_second, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
|
||||
litest_add("tap-2fg:2fg", touchpad_2fg_tap_quickrelease, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue