diff options
author | Peter Osterlund <petero2@telia.com> | 2003-07-04 20:50:19 +0200 |
---|---|---|
committer | Peter Osterlund <petero2@telia.com> | 2006-04-09 04:01:00 +0200 |
commit | cde4d060e04a1684df99d81136c7107ee2050bc4 (patch) | |
tree | 9cf659d6a5fc5101126c48e4a4903d1c98905c1d | |
parent | 85b9edee3325772b10824ecd58042165a4240a7e (diff) |
Use packet counting instead of time to decide when to start
generating pointer movement events. This fixes the bug that incorrectly
moved the cursor to the upper right corner when quickly putting the
finger on the touchpad.
-rw-r--r-- | synaptics.c | 25 | ||||
-rw-r--r-- | synaptics.h | 3 |
2 files changed, 12 insertions, 16 deletions
diff --git a/synaptics.c b/synaptics.c index a4da902..dd6788b 100644 --- a/synaptics.c +++ b/synaptics.c @@ -202,7 +202,7 @@ SynapticsPreInit(InputDriverPtr drv, IDevPtr dev, int flags) priv->repeatButtons = 0; priv->nextRepeat = 0; now = GetTimeInMillis(); - priv->finger_millis = now; + priv->count_packet_finger = 0; priv->tapping_millis = now; priv->button_delay_millis = now; priv->touch_on.millis = now; @@ -538,7 +538,7 @@ timerFunc(OsTimerPtr timer, CARD32 now, pointer arg) } -#define MOVE_HIST(a) (priv->move_hist[((priv->move_hist_idx-(a))%SYNAPTICS_MOVE_HISTORY)]) +#define MOVE_HIST(a) (priv->move_hist[((priv->count_packet_finger-(a))%SYNAPTICS_MOVE_HISTORY)]) static int clamp(int val, int min, int max) { @@ -927,11 +927,9 @@ HandleState(LocalDevicePtr local, struct SynapticsHwState* hw) if(finger && !priv->vert_scroll_on && !priv->horiz_scroll_on && !priv->finger_count && !priv->palm) { - timeleft = TIME_DIFF(priv->finger_millis + 50, hw->millis); - if (timeleft > 0) - delay = MIN(delay, timeleft); - if (timeleft <= 0) - { + delay = MIN(delay, 13); + if (priv->count_packet_finger > 3) + { /* min. 3 packets */ delay = MIN(delay, 13); dy = (1 * @@ -972,10 +970,12 @@ HandleState(LocalDevicePtr local, struct SynapticsHwState* hw) priv->frac_y = xf86modf((dy * speed) + priv->frac_y, &integral); dy = integral; } + + priv->count_packet_finger++; } else - { - priv->finger_millis = hw->millis; + { /* reset packet counter */ + priv->count_packet_finger = 0; } @@ -989,11 +989,8 @@ HandleState(LocalDevicePtr local, struct SynapticsHwState* hw) priv->finger_flag = finger; /* generate a history of the absolute positions */ - if (1) { - priv->move_hist_idx++; - MOVE_HIST(0).y = hw->y; - MOVE_HIST(0).x = hw->x; - } + MOVE_HIST(0).y = hw->y; + MOVE_HIST(0).x = hw->x; /* Post events */ if(dx || dy) diff --git a/synaptics.h b/synaptics.h index 2d669b1..b1e9eba 100644 --- a/synaptics.h +++ b/synaptics.h @@ -126,11 +126,10 @@ typedef struct _SynapticsPrivateRec int fifofd; /* fd for fifo */ SynapticsTapRec touch_on; /* data when the touchpad is touched */ SynapticsMoveHistRec move_hist[SYNAPTICS_MOVE_HISTORY]; /* movement history */ - int move_hist_idx; /* Most recent entry in move_hist[] */ int scroll_y; /* last y-scroll position */ int scroll_x; /* last x-scroll position */ - unsigned long finger_millis; /* Time when finger entered touchpad */ + unsigned long count_packet_finger; /* packet counter with finger on the touchpad */ unsigned int tapping_millis; /* packet counter for tapping */ unsigned int button_delay_millis; /* button delay for 3rd button emulation */ unsigned int prev_up; /* Previous up button value, for double click emulation */ |