touchpad: reset the edge scroll state on touch up if edge scroll is disabled
authorPeter Hutterer <peter.hutterer@who-t.net>
Mon, 22 Aug 2016 06:06:59 +0000 (16:06 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Mon, 22 Aug 2016 21:07:55 +0000 (07:07 +1000)
If a touch was down (and up again) before the device was switched to edge
scrolling, libinput reported an error message:
  litest error: libinput bug: unexpected scroll event 0 in area state

While edge scrolling was disabled, any new touch would be set to the area
state but it was never reset on touch release.

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

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

index 081d2c4..1d30bca 100644 (file)
@@ -338,6 +338,9 @@ tp_edge_scroll_handle_state(struct tp_dispatch *tp, uint64_t time)
                        if (t->state == TOUCH_BEGIN)
                                t->scroll.edge_state =
                                        EDGE_SCROLL_TOUCH_STATE_AREA;
+                       else if (t->state == TOUCH_END)
+                               t->scroll.edge_state =
+                                       EDGE_SCROLL_TOUCH_STATE_NONE;
                }
                return;
        }
index 06bde13..ea20036 100644 (file)
@@ -429,6 +429,10 @@ START_TEST(touchpad_edge_scroll_vert)
        struct litest_device *dev = litest_current_device();
        struct libinput *li = dev->libinput;
 
+       litest_touch_down(dev, 0, 99, 20);
+       litest_touch_move_to(dev, 0, 99, 20, 99, 80, 10, 0);
+       litest_touch_up(dev, 0);
+
        litest_drain_events(li);
        litest_enable_edge_scroll(dev);
 
@@ -466,6 +470,10 @@ START_TEST(touchpad_edge_scroll_horiz)
        struct litest_device *dev = litest_current_device();
        struct libinput *li = dev->libinput;
 
+       litest_touch_down(dev, 0, 99, 20);
+       litest_touch_move_to(dev, 0, 99, 20, 99, 80, 10, 0);
+       litest_touch_up(dev, 0);
+
        if (!touchpad_has_horiz_edge_scroll_size(dev))
                return;