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,
2587 2587
2588 if (priv->scroll.coast_speed_y) { 2588 if (priv->scroll.coast_speed_y) {
2589 double dtime = (hw->millis - priv->scroll.last_millis) / 1000.0; 2589 double dtime = (hw->millis - priv->scroll.last_millis) / 1000.0;
2590 double ddy = para->coasting_friction * dtime; 2590 double ddy = para->coasting_friction * dtime * para->scroll_dist_vert;
2591 priv->scroll.delta_y += priv->scroll.coast_speed_y * dtime; 2591 priv->scroll.delta_y += priv->scroll.coast_speed_y * dtime;
2592 delay = MIN(delay, POLL_MS); 2592 delay = MIN(delay, POLL_MS);
2593 if (abs(priv->scroll.coast_speed_y) < ddy) { 2593 if (abs(priv->scroll.coast_speed_y) < ddy) {
@@ -2600,7 +2600,7 @@ HandleScrolling(SynapticsPrivate *priv, struct SynapticsHwState *hw,
2600 2600
2601 if (priv->scroll.coast_speed_x) { 2601 if (priv->scroll.coast_speed_x) {
2602 double dtime = (hw->millis - priv->scroll.last_millis) / 1000.0; 2602 double dtime = (hw->millis - priv->scroll.last_millis) / 1000.0;
2603 double ddx = para->coasting_friction * dtime; 2603 double ddx = para->coasting_friction * dtime * para->scroll_dist_horiz;
2604 priv->scroll.delta_x += priv->scroll.coast_speed_x * dtime; 2604 priv->scroll.delta_x += priv->scroll.coast_speed_x * dtime;
2605 delay = MIN(delay, POLL_MS); 2605 delay = MIN(delay, POLL_MS);
2606 if (abs(priv->scroll.coast_speed_x) < ddx) { 2606 if (abs(priv->scroll.coast_speed_x) < ddx) {