summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChow Loong Jin <hyperair@debian.org>2012-04-16 11:39:44 +0800
committerPeter Hutterer <peter.hutterer@who-t.net>2012-04-17 13:33:13 +1000
commit1c155f644824133315ac5b3dac9076db71430eb6 (patch)
treef48cdee74efee6d1034c49283ab5e957496b7b50
parent50124d3ddf9bbc4be6734b47a273dbd46b4db0ba (diff)
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 <hyperair@debian.org> Tested-by: <Magnus.Kessler@gmx.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--src/synaptics.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/synaptics.c b/src/synaptics.c
index 2ea7375..350567d 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -2587,7 +2587,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) {
@@ -2600,7 +2600,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) {