~ubuntu-branches/ubuntu/quantal/xserver-xorg-input-synaptics/quantal-proposed

« back to all changes in this revision

Viewing changes to debian/patches/205-Reset-hw-x-y-to-INT_MIN-and-skip-HandleState-until-w.patch

  • Committer: Package Import Robot
  • Author(s): Maarten Lankhorst
  • Date: 2012-06-28 21:49:46 UTC
  • mfrom: (61.1.1 quantal)
  • Revision ID: package-import@ubuntu.com-20120628214946-vghmy568ljz9liex
Tags: 1.6.2-1ubuntu2
* Removed patches:
  - 125_option_rec_revert.patch
  - 126_ubuntu_xi22.patch
* Bump xserver to 1.12 minimum

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
5
 
 have x/y events
6
 
 
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.
11
 
 
12
 
Fix this by resetting hw->x/y to INT_MIN and skip state processing until
13
 
both axes are available.
14
 
 
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.
19
 
 
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
22
 
of x/y.
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.
28
 
 
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)
32
 
---
33
 
 src/synaptics.c |   13 +++++++++++++
34
 
 src/synproto.c  |    4 ++--
35
 
 2 files changed, 15 insertions(+), 2 deletions(-)
36
 
 
37
 
diff --git a/src/synaptics.c b/src/synaptics.c
38
 
index 78660f4..cd9f936 100644
39
 
--- a/src/synaptics.c
40
 
+++ b/src/synaptics.c
41
 
@@ -3278,6 +3278,19 @@ HandleState(InputInfoPtr pInfo, struct SynapticsHwState *hw, CARD32 now,
42
 
         return delay;
43
 
     }
44
 
 
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
48
 
+     * that case. */
49
 
+    if (hw->x == INT_MIN || hw->y == INT_MAX) {
50
 
+        if (para->clickpad)
51
 
+            return delay;
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;
55
 
+        }
56
 
+    }
57
 
+
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
63
 
--- a/src/synproto.c
64
 
+++ b/src/synproto.c
65
 
@@ -134,8 +134,8 @@ void
66
 
 SynapticsResetHwState(struct SynapticsHwState *hw)
67
 
 {
68
 
     hw->millis = 0;
69
 
-    hw->x = 0;
70
 
-    hw->y = 0;
71
 
+    hw->x = INT_MIN;
72
 
+    hw->y = INT_MIN;
73
 
     hw->z = 0;
74
 
     hw->cumulative_dx = 0;
75
 
     hw->cumulative_dy = 0;
76
 
1.7.9.5
77