[PATCH] touchpad: Make sure we don't underflow tap_finger_count

Peter Hutterer peter.hutterer at who-t.net
Wed Apr 29 22:58:44 PDT 2015


On Wed, Apr 29, 2015 at 07:18:55PM +0200, Rui Matos wrote:
> If a touch begins before tap gets enabled we underflow
> tap_finger_count when the touch ends.
> 
> This happens in practice when enabling tapping on a GUI with a
> touchpad click.
> 
> Signed-off-by: Rui Matos <tiagomatos at gmail.com>
> ---
> 
> This patch seems enough to fix the issue in my testing but I'm not
> familiar with the state machine so it might not be the best solution.
> 

ooops, well spotted, that's been an issue for a while and the tests didn't
trigger this (or at least didn't blow up on it). Fix is a bit more
complicated though, patches coming up in a second.

Cheers,
   Peter

>  src/evdev-mt-touchpad-tap.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/evdev-mt-touchpad-tap.c b/src/evdev-mt-touchpad-tap.c
> index 0f25e26..0feff70 100644
> --- a/src/evdev-mt-touchpad-tap.c
> +++ b/src/evdev-mt-touchpad-tap.c
> @@ -659,7 +659,8 @@ tp_tap_handle_state(struct tp_dispatch *tp, uint64_t time)
>  				tp_tap_handle_event(tp, t, TAP_EVENT_MOTION, time);
>  
>  		} else if (t->state == TOUCH_END) {
> -			tp->tap.tap_finger_count--;
> +			if (tp->tap.tap_finger_count > 0)
> +				tp->tap.tap_finger_count--;
>  			tp_tap_handle_event(tp, t, TAP_EVENT_RELEASE, time);
>  			t->tap.state = TAP_TOUCH_STATE_IDLE;
>  		} else if (tp->tap.state != TAP_STATE_IDLE &&
> -- 
> 2.3.6
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
> 


More information about the wayland-devel mailing list