[PATCH libinput] filter: always average the velocity of the first two events
Peter Hutterer
peter.hutterer at who-t.net
Thu Apr 26 04:39:45 UTC 2018
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 <peter.hutterer at who-t.net>
---
Still waiting on test results but this papers over some of the jumps. Turns
out the xserver has that code too, it's just well-hidden. Together with
synaptic's lower acceleration (in most cases) this is probably a reason why
pointer jumps in libinput are more pronounced.
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
More information about the wayland-devel
mailing list