evdev-touchpad: replace some numbers with a #define
authorPeter Hutterer <peter.hutterer@who-t.net>
Fri, 7 Feb 2014 00:32:03 +0000 (10:32 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Mon, 17 Feb 2014 04:35:08 +0000 (14:35 +1000)
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
src/evdev-touchpad.c

index c12c4426cf00e33b0f3f2226c6dc3d733ddc89b2..9e95906cba849c74c9018b76e6dc326b0b5cbbb5 100644 (file)
@@ -82,6 +82,7 @@ enum touchpad_state {
 };
 
 #define TOUCHPAD_HISTORY_LENGTH 4
+#define TOUCHPAD_MIN_SAMPLES 4 /* Number of samples before we start sending events */
 
 struct touchpad_motion {
        int32_t x;
@@ -523,10 +524,10 @@ touchpad_update_state(struct touchpad_dispatch *touchpad, uint32_t time)
        touchpad->motion_index = motion_index;
        touchpad->motion_history[motion_index].x = touchpad->hw_abs.x;
        touchpad->motion_history[motion_index].y = touchpad->hw_abs.y;
-       if (touchpad->motion_count < 4)
+       if (touchpad->motion_count < TOUCHPAD_HISTORY_LENGTH)
                touchpad->motion_count++;
 
-       if (touchpad->motion_count >= 4) {
+       if (touchpad->motion_count >= TOUCHPAD_MIN_SAMPLES) {
                touchpad_get_delta(touchpad, &dx, &dy);
 
                filter_motion(touchpad, &dx, &dy, time);