[PATCH libinput 2/3] filter: split a condition up so we can mark it as bug

Peter Hutterer peter.hutterer at who-t.net
Wed Dec 14 07:36:17 UTC 2016


Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/filter.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/filter.c b/src/filter.c
index 0bb066c..a7cb545 100644
--- a/src/filter.c
+++ b/src/filter.c
@@ -245,9 +245,12 @@ calculate_velocity(struct pointer_accelerator *accel, uint64_t time)
 	for (offset = 1; offset < NUM_POINTER_TRACKERS; offset++) {
 		tracker = tracker_by_offset(accel, offset);
 
+		/* Bug: time running backwards */
+		if (tracker->time > time)
+			break;
+
 		/* Stop if too far away in time */
-		if (time - tracker->time > MOTION_TIMEOUT ||
-		    tracker->time > time) {
+		if (time - tracker->time > MOTION_TIMEOUT) {
 			if (offset == 1)
 				result = calculate_velocity_after_timeout(tracker);
 			break;
-- 
2.9.3



More information about the wayland-devel mailing list