[PATCH libinput 1/2] filter: change the tracker delta type to device-units
Peter Hutterer
peter.hutterer at who-t.net
Thu Jan 19 02:34:44 UTC 2017
We were just switching type here without actual normalization, the filter code
is in device units as of bdd4264d6150f4a6248eec7.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
src/filter.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/filter.c b/src/filter.c
index d7a1515..3035234 100644
--- a/src/filter.c
+++ b/src/filter.c
@@ -156,7 +156,7 @@ filter_get_type(struct motion_filter *filter)
#define NUM_POINTER_TRACKERS 16
struct pointer_tracker {
- struct normalized_coords delta; /* delta to most recent event */
+ struct device_float_coords delta; /* delta to most recent event */
uint64_t time; /* us */
uint32_t dir;
};
@@ -230,7 +230,7 @@ static double
calculate_tracker_velocity(struct pointer_tracker *tracker, uint64_t time)
{
double tdelta = time - tracker->time + 1;
- return normalized_length(tracker->delta) / tdelta; /* units/us */
+ return hypot(tracker->delta.x, tracker->delta.y) / tdelta; /* units/us */
}
static inline double
--
2.9.3
More information about the wayland-devel
mailing list