summaryrefslogtreecommitdiff
path: root/driver/xf86-input-synaptics
diff options
context:
space:
mode:
authorUlf Brosziewski <bru@cvs.openbsd.org>2016-04-22 23:06:54 +0000
committerUlf Brosziewski <bru@cvs.openbsd.org>2016-04-22 23:06:54 +0000
commit4a9b9ee12660082a9505e1219fdc95818f342572 (patch)
tree5d2b6251074560b54e7627515dc15ff58b443762 /driver/xf86-input-synaptics
parent9786ec6854989d97423e8aa1131e83c9231ee9dc (diff)
Don't stop scrolling when handling TOUCH_RESET events.
To avoid jumps, the original version of the handler clears the scroll flags. The method works well if a scroll gesture continues, but it can preclude "coasting". The new version adjusts the coordinates that determine the speed and direction of scrolling. ok shadchin@, mpi@
Diffstat (limited to 'driver/xf86-input-synaptics')
-rw-r--r--driver/xf86-input-synaptics/src/wsconscomm.c34
1 files changed, 26 insertions, 8 deletions
diff --git a/driver/xf86-input-synaptics/src/wsconscomm.c b/driver/xf86-input-synaptics/src/wsconscomm.c
index 5a8e4b3c7..4dea4b31b 100644
--- a/driver/xf86-input-synaptics/src/wsconscomm.c
+++ b/driver/xf86-input-synaptics/src/wsconscomm.c
@@ -150,6 +150,21 @@ WSConsQueryHardware(InputInfoPtr pInfo)
return WSConsIsTouchpad(pInfo, NULL);
}
+static void
+WSConsAdjustScrollCoords(SynapticsPrivate *priv, struct SynapticsHwState *hw)
+{
+ int dx, dy, i;
+
+ dx = hw->x - priv->scroll.last_x;
+ dy = hw->y - priv->scroll.last_y;
+ priv->scroll.last_x = hw->x;
+ priv->scroll.last_y = hw->y;
+ for (i = 0; i < SYNAPTICS_MOVE_HISTORY; i++) {
+ priv->move_hist[i].x += dx;
+ priv->move_hist[i].y += dy;
+ }
+}
+
static Bool
WSConsReadHwState(InputInfoPtr pInfo,
struct CommData *comm, struct SynapticsHwState *hwRet)
@@ -158,7 +173,7 @@ WSConsReadHwState(InputInfoPtr pInfo,
struct wsconscomm_proto_data *proto_data = priv->proto_data;
struct SynapticsHwState *hw = comm->hwState;
struct wscons_event *event;
- Bool v;
+ Bool v, reset = FALSE;
while ((event = WSConsGetEvent(pInfo)) != NULL) {
switch (event->type) {
@@ -229,15 +244,18 @@ WSConsReadHwState(InputInfoPtr pInfo,
hw->fingerWidth = event->value;
break;
case WSCONS_EVENT_TOUCH_RESET:
- /*
- * The contact count or the active MT-slot has changed.
- * Suppress pointer motion and two-finger scrolling.
- */
- priv->count_packet_finger = 0;
- priv->vert_scroll_twofinger_on = FALSE;
- priv->horiz_scroll_twofinger_on = FALSE;
+ /* The contact count or the active MT slot has changed. */
+ reset = TRUE;
break;
case WSCONS_EVENT_SYNC:
+ if (reset) {
+ /* Ensure that pointer motion stops. */
+ priv->count_packet_finger = 0;
+ if (priv->vert_scroll_twofinger_on
+ || priv->horiz_scroll_twofinger_on) {
+ WSConsAdjustScrollCoords(priv, hw);
+ }
+ }
hw->millis = 1000 * event->time.tv_sec +
event->time.tv_nsec / 1000000;
SynapticsCopyHwState(hwRet, hw);