[PATCH libinput] touchpad: reset the edge scroll state on touch up if edge scroll is disabled

Hans de Goede hdegoede at redhat.com
Mon Aug 22 07:31:59 UTC 2016


Hi,

On 22-08-16 08:17, Peter Hutterer wrote:
> 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 at who-t.net>

Looks good to me:

Reviewed-by: Hans de Goede <hdegoede at redhat.com>

Regards,

Hans


> ---
>  src/evdev-mt-touchpad-edge-scroll.c | 3 +++
>  test/touchpad.c                     | 8 ++++++++
>  2 files changed, 11 insertions(+)
>
> diff --git a/src/evdev-mt-touchpad-edge-scroll.c b/src/evdev-mt-touchpad-edge-scroll.c
> index 081d2c4..1d30bca 100644
> --- a/src/evdev-mt-touchpad-edge-scroll.c
> +++ b/src/evdev-mt-touchpad-edge-scroll.c
> @@ -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;
>  	}
> diff --git a/test/touchpad.c b/test/touchpad.c
> index 06bde13..ea20036 100644
> --- a/test/touchpad.c
> +++ b/test/touchpad.c
> @@ -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;
>
>


More information about the wayland-devel mailing list