touchpad: handle a palm down in the tapped state

We expected the first event after TAPPED to be a finger down. If that finger
has been recognised as palm, the finger state isn't TOUCH_BEGIN so we get an
invalid state in our FSM.

  libinput bug: 0: invalid tap event TAP_EVENT_PALM in state TAP_STATE_TAPPED

https://bugs.freedesktop.org/show_bug.cgi?id=105370

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2018-03-07 10:58:17 +10:00
parent f734e973be
commit 2ab233857d
3 changed files with 643 additions and 340 deletions

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 166 KiB

After

Width:  |  Height:  |  Size: 166 KiB

View file

@ -312,9 +312,9 @@ tp_tap_tapped_handle_event(struct tp_dispatch *tp,
LIBINPUT_BUTTON_STATE_RELEASED);
break;
case TAP_EVENT_THUMB:
case TAP_EVENT_PALM:
log_tap_bug(tp, t, event);
break;
case TAP_EVENT_PALM:
case TAP_EVENT_PALM_UP:
break;
}

View file

@ -2649,6 +2649,48 @@ START_TEST(touchpad_tap_palm_on_tapped)
}
END_TEST
START_TEST(touchpad_tap_palm_on_tapped_palm_down)
{
struct litest_device *dev = litest_current_device();
struct libinput *li = dev->libinput;
struct axis_replacement axes[] = {
{ ABS_MT_PRESSURE, 75 },
{ -1, 0 }
};
if (!touchpad_has_palm_pressure(dev))
return;
litest_enable_tap(dev->libinput_device);
litest_drain_events(li);
/* tap + palm down */
litest_touch_down(dev, 0, 50, 50);
litest_touch_up(dev, 0);
libinput_dispatch(li);
litest_assert_button_event(li,
BTN_LEFT,
LIBINPUT_BUTTON_STATE_PRESSED);
litest_touch_down_extended(dev, 0, 50, 50, axes);
litest_touch_move_to_extended(dev, 0, 50, 50, 50, 50, axes, 1, 1);
litest_touch_up(dev, 0);
libinput_dispatch(li);
litest_timeout_tap();
libinput_dispatch(li);
litest_assert_button_event(li,
BTN_LEFT,
LIBINPUT_BUTTON_STATE_RELEASED);
litest_assert_empty_queue(li);
}
END_TEST
START_TEST(touchpad_tap_palm_on_tapped_2fg)
{
struct litest_device *dev = litest_current_device();
@ -3429,6 +3471,7 @@ litest_setup_tests_touchpad_tap(void)
litest_add("tap:palm", touchpad_tap_palm_on_touch_hold_timeout, LITEST_TOUCHPAD, LITEST_ANY);
litest_add("tap:palm", touchpad_tap_palm_on_touch_hold_move, LITEST_TOUCHPAD, LITEST_ANY);
litest_add("tap:palm", touchpad_tap_palm_on_tapped, LITEST_TOUCHPAD, LITEST_ANY);
litest_add("tap:palm", touchpad_tap_palm_on_tapped_palm_down, LITEST_TOUCHPAD, LITEST_ANY);
litest_add("tap:palm", touchpad_tap_palm_on_tapped_2fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
litest_add("tap:palm", touchpad_tap_palm_on_drag, LITEST_TOUCHPAD, LITEST_ANY);
litest_add_ranged("tap:palm", touchpad_tap_palm_on_drag_2fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &range_2fg);