From aa8910ec72f4d5b805c59c609f48c55cc3f8adf8 Mon Sep 17 00:00:00 2001 From: Peter Osterlund Date: Tue, 4 Jan 2005 00:41:24 +0100 Subject: Improved edge motion behavior. The speed no longer depends on the MinSpeed, MaxSpeed and AccelFactor parameters, and it doesn't depend on the packet rate from the touchpad hardware. The EdgeMotionMinSpeed and EdgeMotionMaxSpeed parameters may have to be modified to get the same speed as before this change. --- README.alps | 4 ++-- synaptics.c | 17 ++++++++++------- synaptics.h | 9 ++------- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/README.alps b/README.alps index ffa7786..237f489 100644 --- a/README.alps +++ b/README.alps @@ -26,8 +26,8 @@ Section "InputDevice" Option "MinSpeed" "0.2" Option "MaxSpeed" "0.5" Option "AccelFactor" "0.01" - Option "EdgeMotionMinSpeed" "15" - Option "EdgeMotionMaxSpeed" "15" + Option "EdgeMotionMinSpeed" "100" + Option "EdgeMotionMaxSpeed" "100" Option "UpDownScrolling" "1" Option "CircularScrolling" "1" Option "CircScrollDelta" "0.1" diff --git a/synaptics.c b/synaptics.c index 7a42f7f..cffa803 100644 --- a/synaptics.c +++ b/synaptics.c @@ -1160,6 +1160,10 @@ static long ComputeDeltas(SynapticsPrivate *priv, struct SynapticsHwState *hw, !priv->vert_scroll_on && !priv->horiz_scroll_on && !priv->circ_scroll_on) { delay = MIN(delay, 13); if (priv->count_packet_finger > 3) { /* min. 3 packets */ + double tmpf; + int x_edge_speed = 0; + int y_edge_speed = 0; + double dtime = (hw->millis - MOVE_HIST(1).millis) / 1000.0; dx = (hw->x - MOVE_HIST(2).x) / 2; dy = (hw->y - MOVE_HIST(2).y) / 2; @@ -1169,8 +1173,6 @@ static long ComputeDeltas(SynapticsPrivate *priv, struct SynapticsHwState *hw, int minSpd = para->edge_motion_min_speed; int maxSpd = para->edge_motion_max_speed; int edge_speed; - int x_edge_speed = 0; - int y_edge_speed = 0; if (hw->z <= minZ) { edge_speed = minSpd; @@ -1199,8 +1201,6 @@ static long ComputeDeltas(SynapticsPrivate *priv, struct SynapticsHwState *hw, x_edge_speed = (int)(edge_speed * relX); y_edge_speed = (int)(edge_speed * relY); } - dx += x_edge_speed; - dy += y_edge_speed; } /* speed depending on distance/packet */ @@ -1212,10 +1212,12 @@ static long ComputeDeltas(SynapticsPrivate *priv, struct SynapticsHwState *hw, speed = para->min_speed; } - /* save the fraction for adding to the next priv->count_packet */ - priv->frac_x = xf86modf((dx * speed) + priv->frac_x, &integral); + /* save the fraction, report the integer part */ + tmpf = dx * speed + x_edge_speed * dtime + priv->frac_x; + priv->frac_x = xf86modf(tmpf, &integral); dx = integral; - priv->frac_y = xf86modf((dy * speed) + priv->frac_y, &integral); + tmpf = dy * speed + y_edge_speed * dtime + priv->frac_y; + priv->frac_y = xf86modf(tmpf, &integral); dy = integral; } @@ -1236,6 +1238,7 @@ static long ComputeDeltas(SynapticsPrivate *priv, struct SynapticsHwState *hw, /* generate a history of the absolute positions */ MOVE_HIST(0).x = hw->x; MOVE_HIST(0).y = hw->y; + MOVE_HIST(0).millis = hw->millis; return delay; } diff --git a/synaptics.h b/synaptics.h index 3e68e24..f96583a 100644 --- a/synaptics.h +++ b/synaptics.h @@ -106,15 +106,10 @@ typedef struct _SynapticsSHM *****************************************************************************/ #define SYNAPTICS_MOVE_HISTORY 5 -typedef struct _SynapticsTapRec -{ - int x, y; - unsigned int millis; -} SynapticsTapRec; - typedef struct _SynapticsMoveHist { int x, y; + unsigned int millis; } SynapticsMoveHistRec; enum MidButtonEmulation { @@ -178,7 +173,7 @@ typedef struct _SynapticsPrivateRec int tap_max_fingers; /* Max number of fingers seen since entering start state */ int tap_button; /* Which button started the tap processing */ enum TapButtonState tap_button_state; /* Current tap action */ - SynapticsTapRec touch_on; /* data when the touchpad is touched/released */ + SynapticsMoveHistRec touch_on; /* data when the touchpad is touched/released */ Bool vert_scroll_on; /* scrolling flag */ Bool horiz_scroll_on; /* scrolling flag */ -- cgit v1.2.3