[PATCH libinput 5/6] accel_profile_smooth_simple: Fix jump in acceleration curve

Peter Hutterer peter.hutterer at who-t.net
Mon Jul 7 16:21:21 PDT 2014


From: Hans de Goede <hdegoede at redhat.com>

There was an error in the value passed to the second calc_penumbral_gradient
call causing a jump in the acceleration curve. This commit fixes this.

Signed-off-by: Hans de Goede <hdegoede at redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/filter.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/filter.c b/src/filter.c
index 487669c..8192dd0 100644
--- a/src/filter.c
+++ b/src/filter.c
@@ -353,6 +353,8 @@ pointer_accel_profile_smooth_simple(struct motion_filter *filter,
 	if (velocity >= accel)
 		return accel;
 
-	smooth_accel_coefficient = calc_penumbral_gradient(velocity / accel);
+	/* Velocity is between 1.0 and accel, scale this to 0.0 - 1.0 */
+	velocity = (velocity - 1.0) / (accel - 1.0);
+	smooth_accel_coefficient = calc_penumbral_gradient(velocity);
 	return 1.0 + (smooth_accel_coefficient * (accel - 1.0));
 }
-- 
1.9.3



More information about the wayland-devel mailing list