touchpad: Use TOUCHPAD_MIN_SAMPLES in tp_get_delta

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>
This commit is contained in:
Hans de Goede 2014-12-09 12:47:11 +01:00 committed by Peter Hutterer
parent 6664144611
commit d21c8886c4

View file

@ -177,7 +177,7 @@ tp_estimate_delta(int x0, int x1, int x2, int x3)
void void
tp_get_delta(struct tp_touch *t, double *dx, double *dy) 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; *dx = 0;
*dy = 0; *dy = 0;
return; return;
@ -602,9 +602,7 @@ tp_get_pointer_delta(struct tp_dispatch *tp, double *dx, double *dy)
} }
} }
if (!t->is_pointer || if (!t->is_pointer || !t->dirty)
!t->dirty ||
t->history.count < TOUCHPAD_MIN_SAMPLES)
return; return;
tp_get_delta(t, dx, dy); tp_get_delta(t, dx, dy);