From 1ba2f460bb316c9257e108f1bf86cb6f971314d0 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 24 Jun 2015 15:30:39 +1000 Subject: [PATCH libinput] touchpad: tweak the touchpad acceleration curve --- src/filter.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/filter.c b/src/filter.c index a4142e9..d13dcd6 100644 --- a/src/filter.c +++ b/src/filter.c @@ -398,19 +398,26 @@ touchpad_accel_profile_linear(struct motion_filter *filter, double speed_in, uint64_t time) { - /* Once normalized, touchpads see the same - acceleration as mice. that is technically correct but - subjectively wrong, we expect a touchpad to be a lot - slower than a mouse. Apply a magic factor here and proceed - as normal. */ - const double TP_MAGIC_SLOWDOWN = 0.4; - double speed_out; + struct pointer_accelerator *accel_filter = + (struct pointer_accelerator *)filter; - speed_in *= TP_MAGIC_SLOWDOWN; + double s1, s2; + double max_accel = accel_filter->accel; /* unitless factor */ + double threshold = accel_filter->threshold; /* units/ms */ + double incline = accel_filter->incline; + double factor; - speed_out = pointer_accel_profile_linear(filter, data, speed_in, time); + double baseline = 0.3; + threshold = 2.0; + max_accel = 0.5; + incline = 0.05; - return speed_out * TP_MAGIC_SLOWDOWN; + s1 = baseline; + s2 = baseline + (speed_in - threshold) * incline; + + factor = min(max_accel, s2 > baseline ? s2 : s1); + + return factor; } double -- 2.4.3