[PATCH libinput 2/4] filter: perform speed computations with doubles

Derek Foreman derekf at osg.samsung.com
Thu Oct 30 14:34:14 PDT 2014


Converting to integer before the sqrt calculation can cause loss of
motion at low speed.
---
 src/filter.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/filter.c b/src/filter.c
index 205cd03..afb87ef 100644
--- a/src/filter.c
+++ b/src/filter.c
@@ -139,8 +139,8 @@ tracker_by_offset(struct pointer_accelerator *accel, unsigned int offset)
 static double
 calculate_tracker_velocity(struct pointer_tracker *tracker, uint64_t time)
 {
-	int dx;
-	int dy;
+	double dx;
+	double dy;
 	double distance;
 
 	dx = tracker->dx;
-- 
2.1.1



More information about the wayland-devel mailing list