summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/evdev-mt-touchpad.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index d72cb191..7b8514cb 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -262,29 +262,19 @@ tp_end_sequence(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time)
tp_end_touch(tp, t, time);
}
-static double
-tp_estimate_delta(int x0, int x1, int x2, int x3)
-{
- return (x0 + x1 - x2 - x3) / 4.0;
-}
-
struct normalized_coords
tp_get_delta(struct tp_touch *t)
{
struct device_float_coords delta;
const struct normalized_coords zero = { 0.0, 0.0 };
- if (t->history.count < TOUCHPAD_MIN_SAMPLES)
+ if (t->history.count <= 1)
return zero;
- delta.x = tp_estimate_delta(tp_motion_history_offset(t, 0)->x,
- tp_motion_history_offset(t, 1)->x,
- tp_motion_history_offset(t, 2)->x,
- tp_motion_history_offset(t, 3)->x);
- delta.y = tp_estimate_delta(tp_motion_history_offset(t, 0)->y,
- tp_motion_history_offset(t, 1)->y,
- tp_motion_history_offset(t, 2)->y,
- tp_motion_history_offset(t, 3)->y);
+ delta.x = tp_motion_history_offset(t, 0)->x -
+ tp_motion_history_offset(t, 1)->x;
+ delta.y = tp_motion_history_offset(t, 0)->y -
+ tp_motion_history_offset(t, 1)->y;
return tp_normalize_delta(t->tp, delta);
}