From: Peter Hutterer Date: Wed, 16 Oct 2019 02:50:44 +0000 (+1000) Subject: fallback: don't send a single-touch motion if we just sent a begin X-Git-Tag: 1.14.901~76 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f392766155b42b5c423f82bce5637001f22948df;p=platform%2Fupstream%2Flibinput.git 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 --- 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);