fallback: don't send a single-touch motion if we just sent a begin

Any touch down event will also provide motion data, but we must not send a
motion event for those in the same frame as the down event.

Fixes #375

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2019-10-16 12:50:44 +10:00
parent 8c92328dc5
commit f392766155
2 changed files with 22 additions and 3 deletions

View file

@ -977,9 +977,7 @@ fallback_handle_state(struct fallback_dispatch *dispatch,
if (dispatch->pending_event & EVDEV_ABSOLUTE_TOUCH_DOWN) {
if (fallback_flush_st_down(dispatch, device, time))
need_touch_frame = true;
}
if (dispatch->pending_event & EVDEV_ABSOLUTE_MOTION) {
} else if (dispatch->pending_event & EVDEV_ABSOLUTE_MOTION) {
if (device->seat_caps & EVDEV_DEVICE_TOUCH) {
if (fallback_flush_st_motion(dispatch,
device,

View file

@ -64,6 +64,25 @@ START_TEST(touch_frame_events)
}
END_TEST
START_TEST(touch_downup_no_motion)
{
struct litest_device *dev = litest_current_device();
struct libinput *li = dev->libinput;
litest_drain_events(li);
litest_touch_down(dev, 0, 10, 10);
libinput_dispatch(li);
litest_assert_touch_down_frame(li);
litest_touch_up(dev, 0);
libinput_dispatch(li);
litest_assert_touch_up_frame(li);
}
END_TEST
START_TEST(touch_abs_transform)
{
struct litest_device *dev;
@ -1322,6 +1341,8 @@ TEST_COLLECTION(touch)
struct range axes = { ABS_X, ABS_Y + 1};
litest_add("touch:frame", touch_frame_events, LITEST_TOUCH, LITEST_ANY);
litest_add("touch:down", touch_downup_no_motion, LITEST_TOUCH, LITEST_ANY);
litest_add("touch:down", touch_downup_no_motion, LITEST_SINGLE_TOUCH, LITEST_TOUCHPAD);
litest_add_no_device("touch:abs-transform", touch_abs_transform);
litest_add("touch:slots", touch_seat_slot, LITEST_TOUCH, LITEST_TOUCHPAD);
litest_add_no_device("touch:slots", touch_many_slots);