summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Lulé <pierre@lule.fr>2012-03-28 00:13:30 +0200
committerPeter Hutterer <peter.hutterer@who-t.net>2012-04-13 13:27:46 +1000
commit5a1612d4496b51682c9043aa064025c545249de6 (patch)
treebe3ac5d8df1512adcc0181629b8d504db4d5cdfd
parentf68ddd9be4202333a1c3ccf536966a96dc0bfde7 (diff)
Fix coasting speed
Fixes a bug introduced in commit 2603ad69b997c999404ecc441e0d64ea2cc22018 (Use the scroll distances as increment for scrolling valuator axes) Since this commit, scroll distance was set with SetScrollValuator function but it was still used as a divisor to calculate coasting, thus making coasting too slow. (at least on my computer) Deleting the divisor fixes the issue. A report of the same bug : https://bugs.archlinux.org/task/28955 Signed-off-by: Pierre Lulé <pierre@lule.fr> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--src/synaptics.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/src/synaptics.c b/src/synaptics.c
index 3681b41..fd6eb73 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -2330,39 +2330,36 @@ start_coasting(SynapticsPrivate *priv, struct SynapticsHwState *hw,
double pkt_time = HIST_DELTA(0, 3, millis) / 1000.0;
if (vert && !circ) {
double dy = estimate_delta(HIST(0).y, HIST(1).y, HIST(2).y, HIST(3).y);
- int sdelta = para->scroll_dist_vert;
- if (pkt_time > 0 && sdelta > 0) {
- double scrolls_per_sec = dy / pkt_time / sdelta;
+ if (pkt_time > 0) {
+ double scrolls_per_sec = dy / pkt_time;
if (fabs(scrolls_per_sec) >= para->coasting_speed) {
priv->scroll.coast_speed_y = scrolls_per_sec;
- priv->scroll.coast_delta_y = (hw->y - priv->scroll.last_y) / (double)sdelta;
+ priv->scroll.coast_delta_y = (hw->y - priv->scroll.last_y);
}
}
}
if (horiz && !circ){
double dx = estimate_delta(HIST(0).x, HIST(1).x, HIST(2).x, HIST(3).x);
- int sdelta = para->scroll_dist_horiz;
- if (pkt_time > 0 && sdelta > 0) {
- double scrolls_per_sec = dx / pkt_time / sdelta;
+ if (pkt_time > 0) {
+ double scrolls_per_sec = dx / pkt_time;
if (fabs(scrolls_per_sec) >= para->coasting_speed) {
priv->scroll.coast_speed_x = scrolls_per_sec;
- priv->scroll.coast_delta_x = (hw->x - priv->scroll.last_x) / (double)sdelta;
+ priv->scroll.coast_delta_x = (hw->x - priv->scroll.last_x);
}
}
}
if (circ) {
double da = estimate_delta_circ(priv);
- double sdelta = para->scroll_dist_circ;
- if (pkt_time > 0 && sdelta > 0) {
- double scrolls_per_sec = da / pkt_time / sdelta;
+ if (pkt_time > 0) {
+ double scrolls_per_sec = da / pkt_time;
if (fabs(scrolls_per_sec) >= para->coasting_speed) {
if (vert) {
priv->scroll.coast_speed_y = scrolls_per_sec;
- priv->scroll.coast_delta_y = diffa(priv->scroll.last_a, angle(priv, hw->x, hw->y)) / sdelta;
+ priv->scroll.coast_delta_y = diffa(priv->scroll.last_a, angle(priv, hw->x, hw->y));
}
else if (horiz) {
priv->scroll.coast_speed_x = scrolls_per_sec;
- priv->scroll.coast_delta_x = diffa(priv->scroll.last_a, angle(priv, hw->x, hw->y)) / sdelta;
+ priv->scroll.coast_delta_x = diffa(priv->scroll.last_a, angle(priv, hw->x, hw->y));
}
}
}