1
From f8d970e191e6df05a8f2c26afdeea3e27b941a62 Mon Sep 17 00:00:00 2001
2
From: Peter Hutterer <peter.hutterer@who-t.net>
3
Date: Thu, 17 May 2012 11:02:02 +1000
4
Subject: [PATCH 5/6] Reset hw->x/y to INT_MIN and skip HandleState until we
7
The driver assumes x/y is always valid but after coming from a resume we may
8
get a few events with either ABS_X or ABS_Y (not both). Thus we process with
9
hw->x == 0 and hw->y == somevalue, causing cursor jumps when calculating
10
deltas whenver the real hw->x comes in.
12
Fix this by resetting hw->x/y to INT_MIN and skip state processing until
13
both axes are available.
15
For clickpads, this means handling of data will be delayed until we get
16
at least one motion on each axis. Button presses won't be recognised either
17
until that happens. It requires some skill to not trigger motion on both
18
axes, even more to press a button without doing so.
20
For non-clickpads, handling of motion events will be delayed likewise. If a
21
physical button is pressed immediately after resume we have to assume deltas
23
- If the next event is a new touch, it will have ABS_X/ABS_Y set anyway
24
- If the finger was already down, a button event is generated, and the
25
finger has generated ABS_X or ABS_Y only before the event, the next event
26
containing the missing data will cause a jump. The fix for this is more
27
invasive and this is quite a corner-case.
29
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
30
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
31
(cherry picked from commit cd569377cda9b5a4ee00c0137db14f625c76c40f)
33
src/synaptics.c | 13 +++++++++++++
34
src/synproto.c | 4 ++--
35
2 files changed, 15 insertions(+), 2 deletions(-)
37
diff --git a/src/synaptics.c b/src/synaptics.c
38
index 78660f4..cd9f936 100644
41
@@ -3278,6 +3278,19 @@ HandleState(InputInfoPtr pInfo, struct SynapticsHwState *hw, CARD32 now,
45
+ /* We need both and x/y, the driver can't handle just one of the two
46
+ * yet. But since it's possible to hit a phys button on non-clickpads
47
+ * without ever getting motion data first, we must continue with 0/0 for
49
+ if (hw->x == INT_MIN || hw->y == INT_MAX) {
52
+ else if (hw->left || hw->right || hw->middle) {
53
+ hw->x = (hw->x == INT_MIN) ? 0 : hw->x;
54
+ hw->y = (hw->y == INT_MIN) ? 0 : hw->y;
58
/* If a physical button is pressed on a clickpad, use cumulative relative
59
* touch movements for motion */
60
if (para->clickpad && (hw->left || hw->right || hw->middle)) {
61
diff --git a/src/synproto.c b/src/synproto.c
62
index d6e8c65..0c8a066 100644
65
@@ -134,8 +134,8 @@ void
66
SynapticsResetHwState(struct SynapticsHwState *hw)
74
hw->cumulative_dx = 0;
75
hw->cumulative_dy = 0;