[PATCH libinput 4/5] touchpad: don't feed 0/0 deltas into the accel filters

Hans de Goede hdegoede at redhat.com
Tue Jul 8 00:24:04 PDT 2014


Hi,

On 07/08/2014 06:20 AM, Peter Hutterer wrote:
> The resolution-based scaling may result in deltas of 0. The accel code doesn't
> handle 0 deltas too well. 0/0 deltas can't happen for EV_REL devices, so the
> code just isn't designed for it.
> 
> Most notably, events with delta 0/0 have no direction. That messes up the
> history-based velocity calculation which stops whenever the current vector's
> direction changes from the one in the trackers.
> 
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
>  src/evdev-mt-touchpad.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
> index 0b06810..cf97eae 100644
> --- a/src/evdev-mt-touchpad.c
> +++ b/src/evdev-mt-touchpad.c
> @@ -63,7 +63,8 @@ tp_filter_motion(struct tp_dispatch *tp,
>  	motion.dx = *dx * tp->accel.x_scale_coeff;
>  	motion.dy = *dy * tp->accel.y_scale_coeff;
>  
> -	filter_dispatch(tp->filter, &motion, tp, time);
> +	if (motion.dx != 0.0 || motion.dy != 0)
> +		filter_dispatch(tp->filter, &motion, tp, time);
>  

Please change the second "!= 0" into "!= 0.0". Other then that this
series looks good and is:

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

Regards,

Hans


More information about the wayland-devel mailing list