touchpad: Use TOUCHPAD_MIN_SAMPLES in tp_get_delta
authorHans de Goede <hdegoede@redhat.com>
Tue, 9 Dec 2014 11:47:11 +0000 (12:47 +0100)
committerPeter Hutterer <peter.hutterer@who-t.net>
Wed, 17 Dec 2014 06:20:20 +0000 (16:20 +1000)
Use TOUCHPAD_MIN_SAMPLES in tp_get_delta rather then hardcoding "4".

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.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
src/evdev-mt-touchpad.c

index e8bd77b..964900d 100644 (file)
@@ -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;
@@ -602,9 +602,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);