On 16/04/2012 11:44, Chow Loong Jin wrote:
> [...]

Whoops, looks like the patch got corrupted, and I forgot to sign-off. Here's the
amended patch as an attachment instead.

-- 
Kind regards,
Loong Jin
From 00de516c1325312781a89fad5d7339c1045ee3cb Mon Sep 17 00:00:00 2001
From: Chow Loong Jin <[email protected]>
Date: Mon, 16 Apr 2012 11:39:44 +0800
Subject: [PATCH] Fix coasting friction

As a result of commit 5a1612d4496b51682c9043aa064025c545249de6, coasting speed
was bumped up to a different scale by removing the divisor during the
calculation of initial coasting speed. This caused coasting friction to have
little to no effect, resulting in coasting that lasted virtually forever using
the default coasting friction value of 50.

This patch multiplies the scroll_dist_{horiz,vert} which was previously used as
a divisor for initial coasting speed to the coasting friction before deducting
it at each step, thus bringing coasting friction back under control.

Signed-off-by: Chow Loong Jin <[email protected]>
---
 src/synaptics.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/synaptics.c b/src/synaptics.c
index 40478ec..2c6b714 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -2585,7 +2585,7 @@ HandleScrolling(SynapticsPrivate *priv, struct SynapticsHwState *hw,
 
     if (priv->scroll.coast_speed_y) {
 	double dtime = (hw->millis - priv->scroll.last_millis) / 1000.0;
-	double ddy = para->coasting_friction * dtime;
+	double ddy = para->coasting_friction * dtime * para->scroll_dist_vert;
 	priv->scroll.delta_y += priv->scroll.coast_speed_y * dtime;
 	delay = MIN(delay, POLL_MS);
 	if (abs(priv->scroll.coast_speed_y) < ddy) {
@@ -2598,7 +2598,7 @@ HandleScrolling(SynapticsPrivate *priv, struct SynapticsHwState *hw,
 
     if (priv->scroll.coast_speed_x) {
 	double dtime = (hw->millis - priv->scroll.last_millis) / 1000.0;
-	double ddx = para->coasting_friction * dtime;
+	double ddx = para->coasting_friction * dtime * para->scroll_dist_horiz;
 	priv->scroll.delta_x += priv->scroll.coast_speed_x * dtime;
 	delay = MIN(delay, POLL_MS);
 	if (abs(priv->scroll.coast_speed_x) < ddx) {
-- 
1.7.9.5

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to