From: Hans de Goede Date: Tue, 9 Dec 2014 11:47:11 +0000 (+0100) Subject: touchpad: Use TOUCHPAD_MIN_SAMPLES in tp_get_delta X-Git-Tag: 0.8.0~55 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d21c8886c4bb8b195d99dcc63cec73cfde0d4f6e;p=platform%2Fupstream%2Flibinput.git 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 Reviewed-by: Peter Hutterer Signed-off-by: Peter Hutterer --- diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c index e8bd77b..964900d 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; @@ -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);