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

Hans de Goede hdegoede at redhat.com
Tue Dec 9 03:47:11 PST 2014


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 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



More information about the wayland-devel mailing list