touchpad: reset the edge scroll state on touch up if edge scroll is disabled

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>
(cherry picked from commit b1a811ee52)
This commit is contained in:
Peter Hutterer 2016-08-22 16:06:59 +10:00
parent cb7cef6f4b
commit 63c9d2dcb0
2 changed files with 11 additions and 0 deletions

View file

@ -339,6 +339,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;
}

View 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;