diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2019-10-16 12:50:44 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2019-10-24 11:12:32 +1000 |
commit | 68b471b31f3e3c506a821637e954c6d213b12df1 (patch) | |
tree | b3bea980547d4bf6d3b2a6507251b1de31b787f6 | |
parent | 47df5c173a9637bd420558815a70dfd1d74303ab (diff) |
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>
(cherry picked from commit f392766155b42b5c423f82bce5637001f22948df)
-rw-r--r-- | src/evdev-fallback.c | 4 | ||||
-rw-r--r-- | test/test-touch.c | 21 |
2 files changed, 22 insertions, 3 deletions
diff --git a/src/evdev-fallback.c b/src/evdev-fallback.c index 05d92cfc..1a9113bc 100644 --- a/src/evdev-fallback.c +++ b/src/evdev-fallback.c @@ -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, diff --git a/test/test-touch.c b/test/test-touch.c index fc2f50c4..81accf94 100644 --- a/test/test-touch.c +++ b/test/test-touch.c @@ -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); |