[PATCH] Fix coasting friction

Chow Loong Jin hyperair at debian.org
Sun Apr 15 20:44:34 PDT 2012


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.
---
 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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 900 bytes
Desc: OpenPGP digital signature
URL: <http://lists.x.org/archives/xorg-devel/attachments/20120416/4f10a86a/attachment.pgp>


More information about the xorg-devel mailing list