Blob Blame History Raw
From 511eda7024caaab10d4e7f701bcd1eedd0329cab Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Fri, 21 Feb 2014 10:31:43 +0100
Subject: [PATCH synaptics 08/14] On button down update cumulative to current x
 and y, instead of previous

When a button click and new coordinates get reported in one go we sync the
cumulative coordinates to the old x and y, rather then the newly reported ones.

This keeping of the old coordinates causes the following issue:
-touch the touchpad in its right click area
-let go of the touchpad
-rapidly click in the left click area (or middle area), so that the
 new location and the click get reported in one syn (may require some
 practicing with evemu-record to reproduce)
-the driver registers the click as a right click because it uses the
 old coordinates from the cumulative coordinates to determine the
 click location

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 743c45b9cfd057d00c37dab1cfca4b6202fb2642)
(cherry picked from commit ad834529c3fb63ced0ed74efb6c382d1761467c8)
---
 src/eventcomm.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/eventcomm.c b/src/eventcomm.c
index 3c2883e..1534b7c 100644
--- a/src/eventcomm.c
+++ b/src/eventcomm.c
@@ -660,6 +660,7 @@ EventReadHwState(InputInfoPtr pInfo,
     SynapticsPrivate *priv = (SynapticsPrivate *) pInfo->private;
     SynapticsParameters *para = &priv->synpara;
     struct eventcomm_proto_data *proto_data = priv->proto_data;
+    Bool sync_cumulative = FALSE;
 
     SynapticsResetTouchHwState(hw, FALSE);
 
@@ -667,6 +668,7 @@ EventReadHwState(InputInfoPtr pInfo,
     if (!hw->left && !hw->right && !hw->middle) {
         hw->cumulative_dx = hw->x;
         hw->cumulative_dy = hw->y;
+        sync_cumulative = TRUE;
     }
 
     while (SynapticsReadEvent(pInfo, &ev)) {
@@ -742,9 +744,13 @@ EventReadHwState(InputInfoPtr pInfo,
                 switch (ev.code) {
                 case ABS_X:
                     hw->x = apply_st_scaling(proto_data, ev.value, 0);
+                    if (sync_cumulative)
+                        hw->cumulative_dx = hw->x;
                     break;
                 case ABS_Y:
                     hw->y = apply_st_scaling(proto_data, ev.value, 1);
+                    if (sync_cumulative)
+                        hw->cumulative_dy = hw->y;
                     break;
                 case ABS_PRESSURE:
                     hw->z = ev.value;
-- 
1.9.3