From 7d06ccc06125844ffc3e914ee8fa0a7b6e0a0df3 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 24 Apr 2018 15:01:39 +1000 Subject: [PATCH libinput] filter: always average the velocity of the first two events Don't apply any velocity diff checking on the first two events, always average them (unless the timeout is hit or the direction changes). This averages out some of the jumps we get on slow motion. Signed-off-by: Peter Hutterer --- src/filter.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/filter.c b/src/filter.c index 7b7e005a..fe60c62a 100644 --- a/src/filter.c +++ b/src/filter.c @@ -248,7 +248,10 @@ trackers_velocity(struct pointer_trackers *trackers, uint64_t time) break; } - if (initial_velocity == 0.0) { + /* Always average the first two events. On some touchpads + * where the first event is jumpy, this somewhat reduces + * pointer jumps on slow motions. */ + if (initial_velocity == 0.0 || offset <= 2) { result = initial_velocity = velocity; } else { /* Stop if velocity differs too much from initial */ -- 2.14.3