|
|
e94010 |
From 8adbeacd1a140e4f1c203dde0c60d488dbec1d26 Mon Sep 17 00:00:00 2001
|
|
|
e94010 |
From: Hans de Goede <hdegoede@redhat.com>
|
|
|
e94010 |
Date: Fri, 21 Feb 2014 10:31:44 +0100
|
|
|
e94010 |
Subject: [PATCH synaptics 09/14] Wait for *new* coordinates on a clickpad
|
|
|
e94010 |
click before reporting the click
|
|
|
e94010 |
|
|
|
e94010 |
It is possible for a click to get reported before any related touch events
|
|
|
e94010 |
get reported, here is the relevant part of an evemu-record session on a T440s:
|
|
|
e94010 |
|
|
|
e94010 |
E: 3.985585 0000 0000 0000 # ------------ SYN_REPORT (0) ----------
|
|
|
e94010 |
E: 3.997419 0003 0039 -001 # EV_ABS / ABS_MT_TRACKING_ID -1
|
|
|
e94010 |
E: 3.997419 0001 014a 0000 # EV_KEY / BTN_TOUCH 0
|
|
|
e94010 |
E: 3.997419 0003 0018 0000 # EV_ABS / ABS_PRESSURE 0
|
|
|
e94010 |
E: 3.997419 0001 0145 0000 # EV_KEY / BTN_TOOL_FINGER 0
|
|
|
e94010 |
E: 3.997419 0000 0000 0000 # ------------ SYN_REPORT (0) ----------
|
|
|
e94010 |
E: 5.117881 0001 0110 0001 # EV_KEY / BTN_LEFT 1
|
|
|
e94010 |
E: 5.117881 0000 0000 0000 # ------------ SYN_REPORT (0) ----------
|
|
|
e94010 |
E: 5.133422 0003 0039 0187 # EV_ABS / ABS_MT_TRACKING_ID 187
|
|
|
e94010 |
E: 5.133422 0003 0035 3098 # EV_ABS / ABS_MT_POSITION_X 3098
|
|
|
e94010 |
E: 5.133422 0003 0036 3282 # EV_ABS / ABS_MT_POSITION_Y 3282
|
|
|
e94010 |
E: 5.133422 0003 003a 0046 # EV_ABS / ABS_MT_PRESSURE 46
|
|
|
e94010 |
E: 5.133422 0001 014a 0001 # EV_KEY / BTN_TOUCH 1
|
|
|
e94010 |
E: 5.133422 0003 0000 3102 # EV_ABS / ABS_X 3102
|
|
|
e94010 |
E: 5.133422 0003 0001 3282 # EV_ABS / ABS_Y 3282
|
|
|
e94010 |
E: 5.133422 0003 0018 0046 # EV_ABS / ABS_PRESSURE 46
|
|
|
e94010 |
E: 5.133422 0001 0145 0001 # EV_KEY / BTN_TOOL_FINGER 1
|
|
|
e94010 |
E: 5.133422 0000 0000 0000 # ------------ SYN_REPORT (0) ----------
|
|
|
e94010 |
|
|
|
e94010 |
Notice the BTN_LEFT event all by itself!
|
|
|
e94010 |
|
|
|
e94010 |
If this happens, it may lead to the following problem scenario:
|
|
|
e94010 |
-touch the touchpad in its right click area
|
|
|
e94010 |
-let go of the touchpad
|
|
|
e94010 |
-rapidly click in the middle area, so that BTN_LEFT gets reported before the
|
|
|
e94010 |
new coordinates (such as seen in the trace above, this may require some
|
|
|
e94010 |
practicing with evemu-record to reproduce)
|
|
|
e94010 |
-the driver registers the click as a right click because it uses the
|
|
|
e94010 |
old coordinates from the cumulative coordinates to determine the
|
|
|
e94010 |
click location
|
|
|
e94010 |
|
|
|
e94010 |
This commit fixes this by:
|
|
|
e94010 |
1) Resetting the cumulative coordinates not only when no button is pressed,
|
|
|
e94010 |
but also when there is no finger touching the touchpad, so that when
|
|
|
e94010 |
we do get a touch the cumulative coordinates start at the right place
|
|
|
e94010 |
2) Delaying processing the BTN_LEFT down transition if there is no finger
|
|
|
e94010 |
touching the touchpad
|
|
|
e94010 |
|
|
|
e94010 |
This approach has one downside, if we wrongly identify a touchpad as
|
|
|
e94010 |
a clickpad, then the left button won't work unless the user touches the
|
|
|
e94010 |
touchpad while clicking the left button.
|
|
|
e94010 |
|
|
|
e94010 |
If we want we can fix this by doing something like this:
|
|
|
e94010 |
1) Making update_hw_button_state return a delay; and
|
|
|
e94010 |
2) Tracking that we've delayed BTN_LEFT down transition processing; and
|
|
|
e94010 |
3) When we've delayed BTN_LEFT down transition return a small delay value; and
|
|
|
e94010 |
4) If when we're called again we still don't have a finger down, just
|
|
|
e94010 |
treat the click as a BTN_LEFT
|
|
|
e94010 |
|
|
|
e94010 |
But this is not worth the trouble IMHO, the proper thing to do in this
|
|
|
e94010 |
scenario is to fix the mis-identification of the touchpad as a clickpad.
|
|
|
e94010 |
|
|
|
e94010 |
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
e94010 |
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
|
|
e94010 |
(cherry picked from commit bbe4c56c4998a90b478581a4d93717251d8e05be)
|
|
|
e94010 |
(cherry picked from commit eb3af31c597ed6dc1bef31f39a5f6c9d586713ae)
|
|
|
e94010 |
---
|
|
|
e94010 |
src/eventcomm.c | 5 +++--
|
|
|
e94010 |
src/synaptics.c | 7 +++++++
|
|
|
e94010 |
2 files changed, 10 insertions(+), 2 deletions(-)
|
|
|
e94010 |
|
|
|
e94010 |
diff --git a/src/eventcomm.c b/src/eventcomm.c
|
|
|
e94010 |
index 1534b7c..4550ef2 100644
|
|
|
e94010 |
--- a/src/eventcomm.c
|
|
|
e94010 |
+++ b/src/eventcomm.c
|
|
|
e94010 |
@@ -664,8 +664,9 @@ EventReadHwState(InputInfoPtr pInfo,
|
|
|
e94010 |
|
|
|
e94010 |
SynapticsResetTouchHwState(hw, FALSE);
|
|
|
e94010 |
|
|
|
e94010 |
- /* Reset cumulative values if buttons were not previously pressed */
|
|
|
e94010 |
- if (!hw->left && !hw->right && !hw->middle) {
|
|
|
e94010 |
+ /* Reset cumulative values if buttons were not previously pressed,
|
|
|
e94010 |
+ * or no finger was previously present. */
|
|
|
e94010 |
+ if ((!hw->left && !hw->right && !hw->middle) || hw->z < para->finger_low) {
|
|
|
e94010 |
hw->cumulative_dx = hw->x;
|
|
|
e94010 |
hw->cumulative_dy = hw->y;
|
|
|
e94010 |
sync_cumulative = TRUE;
|
|
|
e94010 |
diff --git a/src/synaptics.c b/src/synaptics.c
|
|
|
e94010 |
index f289b35..7a39df9 100644
|
|
|
e94010 |
--- a/src/synaptics.c
|
|
|
e94010 |
+++ b/src/synaptics.c
|
|
|
e94010 |
@@ -2660,6 +2660,12 @@ update_hw_button_state(const InputInfoPtr pInfo, struct SynapticsHwState *hw,
|
|
|
e94010 |
if (para->clickpad) {
|
|
|
e94010 |
/* hw->left is down, but no other buttons were already down */
|
|
|
e94010 |
if (!(priv->lastButtons & 7) && hw->left && !hw->right && !hw->middle) {
|
|
|
e94010 |
+ /* If the finger down event is delayed, the x and y
|
|
|
e94010 |
+ * coordinates are stale so we delay processing the click */
|
|
|
e94010 |
+ if (hw->z < para->finger_low) {
|
|
|
e94010 |
+ hw->left = 0;
|
|
|
e94010 |
+ goto out;
|
|
|
e94010 |
+ }
|
|
|
e94010 |
if (is_inside_rightbutton_area(para, hw->x, hw->y)) {
|
|
|
e94010 |
hw->left = 0;
|
|
|
e94010 |
hw->right = 1;
|
|
|
e94010 |
@@ -2691,6 +2697,7 @@ update_hw_button_state(const InputInfoPtr pInfo, struct SynapticsHwState *hw,
|
|
|
e94010 |
if (hw->left && !(priv->lastButtons & 7) && hw->numFingers >= 1)
|
|
|
e94010 |
handle_clickfinger(priv, hw);
|
|
|
e94010 |
|
|
|
e94010 |
+out:
|
|
|
e94010 |
/* Two finger emulation */
|
|
|
e94010 |
if (hw->numFingers == 1 && hw->z >= para->emulate_twofinger_z &&
|
|
|
e94010 |
hw->fingerWidth >= para->emulate_twofinger_w) {
|
|
|
e94010 |
--
|
|
|
e94010 |
1.9.3
|
|
|
e94010 |
|