[PATCH 3/3] touchpad: Use TOUCHPAD_MIN_SAMPLES in tp_get_delta

Peter Hutterer peter.hutterer at who-t.net
Tue Dec 9 19:34:06 PST 2014


On Tue, Dec 09, 2014 at 12:47:11PM +0100, Hans de Goede wrote:
> Use TOUCHPAD_MIN_SAMPLES in tp_get_delta rather then hardcoding "4".

s/then/than/

> Also remove the superfluous TOUCHPAD_MIN_SAMPLES check before calling
> tp_get_delta in tp_get_pointer_delta, this is not necessary as tp_get_delta
> already checks itself.

Right, though note that you're now passing the initial 0/0 deltas into the
filter and thus feed the velocity trackers. Not that it has any effect, 
0 + 0 is still 0...

Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
 
Cheers,
   Peter

> Signed-off-by: Hans de Goede <hdegoede at redhat.com>
> ---
>  src/evdev-mt-touchpad.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
> index 7cee73d..397b8b9 100644
> --- a/src/evdev-mt-touchpad.c
> +++ b/src/evdev-mt-touchpad.c
> @@ -177,7 +177,7 @@ tp_estimate_delta(int x0, int x1, int x2, int x3)
>  void
>  tp_get_delta(struct tp_touch *t, double *dx, double *dy)
>  {
> -	if (t->history.count < 4) {
> +	if (t->history.count < TOUCHPAD_MIN_SAMPLES) {
>  		*dx = 0;
>  		*dy = 0;
>  		return;
> @@ -607,9 +607,7 @@ tp_get_pointer_delta(struct tp_dispatch *tp, double *dx, double *dy)
>  		}
>  	}
>  
> -	if (!t->is_pointer ||
> -	    !t->dirty ||
> -	    t->history.count < TOUCHPAD_MIN_SAMPLES)
> +	if (!t->is_pointer || !t->dirty)
>  		return;
>  
>  	tp_get_delta(t, dx, dy);
> -- 
> 2.1.0
> 
> _______________________________________________
> 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