touchpad: Clear touches being the pointer when doing 2 finger scrolling
authorHans de Goede <hdegoede@redhat.com>
Fri, 23 May 2014 14:06:22 +0000 (16:06 +0200)
committerPeter Hutterer <peter.hutterer@who-t.net>
Tue, 27 May 2014 06:34:51 +0000 (16:34 +1000)
When doing 2 finger scrolling we don't want any spurious movement events after
scrolling. touchpad_2fg_no_motion tests for this, but it lifts touch 0
(which is the pointer as it came down first) first, so it only catches the
case where touch 1 suddenly gets promoted to being the pointer.

However if touch 1 is lifted first, then touch 0 is still the pointer and
will cause spurious movement events. Swap the 2 litest_touch_up calls to
catch this (and make the test fail), and add code to clear the is_pointer
flag on all touched when doing 2 finger scrolling to fix it again.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
src/evdev-mt-touchpad.c
test/touchpad.c

index 89cebd55a0563a868018549436965b923ad975a0..040939b64edf8f4d5dedaf148b94ae4be1d81829 100644 (file)
@@ -479,6 +479,10 @@ tp_post_twofinger_scroll(struct tp_dispatch *tp, uint64_t time)
                        return;
        }
 
+       /* Stop spurious MOTION events at the end of scrolling */
+       tp_for_each_touch(tp, t)
+               t->is_pointer = false;
+
        if (dy != 0.0 &&
            (tp->scroll.direction & (1 << LIBINPUT_POINTER_AXIS_VERTICAL_SCROLL))) {
                pointer_notify_axis(&tp->device->base,
index 959978e54008a55482479528014301496f9625f8..dc2e25baa92c1ad136aaeb333b5c1dc106af1f61 100644 (file)
@@ -74,8 +74,8 @@ START_TEST(touchpad_2fg_no_motion)
        litest_touch_down(dev, 1, 70, 20);
        litest_touch_move_to(dev, 0, 20, 20, 80, 80, 5);
        litest_touch_move_to(dev, 1, 70, 20, 80, 50, 5);
-       litest_touch_up(dev, 0);
        litest_touch_up(dev, 1);
+       litest_touch_up(dev, 0);
 
        libinput_dispatch(li);