summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/synaptics.c16
-rw-r--r--src/synapticsstr.h6
2 files changed, 10 insertions, 12 deletions
diff --git a/src/synaptics.c b/src/synaptics.c
index ee627b3..30d79c5 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -2456,7 +2456,7 @@ start_coasting(SynapticsPrivate * priv, struct SynapticsHwState *hw,
double dy =
estimate_delta(HIST(0).y, HIST(1).y, HIST(2).y, HIST(3).y);
if (pkt_time > 0) {
- double scrolls_per_sec = dy / pkt_time;
+ double scrolls_per_sec = (dy / abs(para->scroll_dist_vert)) / pkt_time;
if (fabs(scrolls_per_sec) >= para->coasting_speed) {
priv->scroll.coast_speed_y = scrolls_per_sec;
@@ -2468,7 +2468,7 @@ start_coasting(SynapticsPrivate * priv, struct SynapticsHwState *hw,
double dx =
estimate_delta(HIST(0).x, HIST(1).x, HIST(2).x, HIST(3).x);
if (pkt_time > 0) {
- double scrolls_per_sec = dx / pkt_time;
+ double scrolls_per_sec = (dx / abs(para->scroll_dist_vert)) / pkt_time;
if (fabs(scrolls_per_sec) >= para->coasting_speed) {
priv->scroll.coast_speed_x = scrolls_per_sec;
@@ -2480,7 +2480,7 @@ start_coasting(SynapticsPrivate * priv, struct SynapticsHwState *hw,
double da = estimate_delta_circ(priv);
if (pkt_time > 0) {
- double scrolls_per_sec = da / pkt_time;
+ double scrolls_per_sec = (da / para->scroll_dist_circ) / pkt_time;
if (fabs(scrolls_per_sec) >= para->coasting_speed) {
if (vert) {
@@ -2738,10 +2738,9 @@ 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 * abs(para->scroll_dist_vert);
+ double ddy = para->coasting_friction * dtime;
- priv->scroll.delta_y += priv->scroll.coast_speed_y * dtime;
+ priv->scroll.delta_y += priv->scroll.coast_speed_y * dtime * para->scroll_dist_vert;
delay = MIN(delay, POLL_MS);
if (abs(priv->scroll.coast_speed_y) < ddy) {
priv->scroll.coast_speed_y = 0;
@@ -2755,9 +2754,8 @@ 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 * abs(para->scroll_dist_horiz);
- priv->scroll.delta_x += priv->scroll.coast_speed_x * dtime;
+ double ddx = para->coasting_friction * dtime;
+ priv->scroll.delta_x += priv->scroll.coast_speed_x * dtime * para->scroll_dist_vert;
delay = MIN(delay, POLL_MS);
if (abs(priv->scroll.coast_speed_x) < ddx) {
priv->scroll.coast_speed_x = 0;
diff --git a/src/synapticsstr.h b/src/synapticsstr.h
index 57ed4ba..dd6a09b 100644
--- a/src/synapticsstr.h
+++ b/src/synapticsstr.h
@@ -168,7 +168,7 @@ typedef struct _SynapticsParameters {
Bool palm_detect; /* Enable Palm Detection */
int palm_min_width; /* Palm detection width */
int palm_min_z; /* Palm detection depth */
- double coasting_speed; /* Coasting threshold scrolling speed */
+ double coasting_speed; /* Coasting threshold scrolling speed in scrolls/s */
double coasting_friction; /* Number of scrolls per second per second to change coasting speed */
int press_motion_min_z; /* finger pressure at which minimum pressure motion factor is applied */
int press_motion_max_z; /* finger pressure at which maximum pressure motion factor is applied */
@@ -216,8 +216,8 @@ struct _SynapticsPrivateRec {
double delta_y; /* accumulated vert scroll delta */
double last_a; /* last angle-scroll position */
CARD32 last_millis; /* time last scroll event posted */
- double coast_speed_x; /* Horizontal coasting speed */
- double coast_speed_y; /* Vertical coasting speed */
+ double coast_speed_x; /* Horizontal coasting speed in scrolls/s */
+ double coast_speed_y; /* Vertical coasting speed in scrolls/s */
double coast_delta_x; /* Accumulated horizontal coast delta */
double coast_delta_y; /* Accumulated vertical coast delta */
int packets_this_scroll; /* Events received for this scroll */