[PATCH xf86-input-synaptics 1/4] Fix clickfinger actions when middle button emulation is enabled

Chase Douglas chase.douglas at canonical.com
Wed Mar 21 12:58:27 PDT 2012

When MBE is enabled, a physical left button press is delayed until a
timeout is reached. This results in the logical left button being
depressed while the physical left button is pressed. The physical state
is stored as the "old" hw state, and it is used for detecting a
transition from depressed to pressed for clickfinger actions. Since the
"old" hw state shows the left button pressed, but the current logical
state shows the left button unpressed, when the MBE timeout fires and we
set the logical left button pressed the transition check fails.

Since the "old" hw state is only used for clickfinger left button press
transitions, redefining it to hold the previous logical hw state is
sufficient for fixing the bug and should not cause any regressions.

Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
 src/synaptics.c    |    5 ++++-
 src/synapticsstr.h |    2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/synaptics.c b/src/synaptics.c
index 489eeaa..9f214e5 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -1611,7 +1611,6 @@ ReadInput(InputInfoPtr pInfo)
 	SynapticsCopyHwState(priv->hwState, hw);
 	delay = HandleState(pInfo, hw, hw->millis, FALSE);
-	SynapticsCopyHwState(priv->old_hw_state, priv->hwState);
 	newDelay = TRUE;
@@ -3236,6 +3235,10 @@ HandleState(InputInfoPtr pInfo, struct SynapticsHwState *hw, CARD32 now,
     /* generate a history of the absolute positions */
     if (inside_active_area)
 	store_history(priv, hw->x, hw->y, hw->millis);
+    /* Save logical state for transition comparisons */
+    SynapticsCopyHwState(priv->old_hw_state, hw);
     return delay;
diff --git a/src/synapticsstr.h b/src/synapticsstr.h
index fcefc46..55aab3d 100644
--- a/src/synapticsstr.h
+++ b/src/synapticsstr.h
@@ -196,7 +196,7 @@ struct _SynapticsPrivateRec
     void *proto_data;			/* protocol-specific data */
     struct SynapticsHwState *hwState;
-    struct SynapticsHwState *old_hw_state; /* previous hw state */
+    struct SynapticsHwState *old_hw_state; /* previous logical hw state */
     const char *device;			/* device node */
     Bool shm_config;			/* True when shared memory area allocated */

More information about the xorg-devel mailing list