diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2012-05-02 10:16:30 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2012-05-03 08:05:29 +1000 |
commit | 52e194b76c9598e0fbf556e3aa97168ed4f0e2b6 (patch) | |
tree | 4ae321fdb1b730e8fafe64db5f56d4ea96457c66 | |
parent | 6f086b86e4bd3c720289e91fdbb933bf3e559e72 (diff) |
Fix coasting for negative scroll directions
1874094f0e99d8db319f6cf769ce5a25c9bc490c introduced negative scroll
directions. Coasting assumed always-positive increments and triggered an
endless scrolling loop.
Reported-by: Matthias Clasen <mclasen@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
-rw-r--r-- | src/synaptics.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/synaptics.c b/src/synaptics.c index 6dc8004..77eb5be 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -2625,7 +2625,8 @@ 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 * para->scroll_dist_vert; + double ddy = para->coasting_friction * dtime * abs(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) { @@ -2638,7 +2639,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 * para->scroll_dist_horiz; + double ddx = para->coasting_friction * dtime * abs(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) { |