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 a4507c6..e792977 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -2109,7 +2109,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;
@@ -2121,7 +2121,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;
@@ -2133,7 +2133,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) {
@@ -2391,10 +2391,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;
@@ -2408,9 +2407,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 4bc2ed5..5b0120a 100644
--- a/src/synapticsstr.h
+++ b/src/synapticsstr.h
@@ -169,7 +169,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 */
@@ -213,8 +213,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 */