summaryrefslogtreecommitdiff
path: root/src/synproto.c
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2012-05-17 11:02:02 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2012-05-18 09:15:46 +1000
commitcd569377cda9b5a4ee00c0137db14f625c76c40f (patch)
tree3b8efa8d2226b5d5760178230f6d060612d8d7b5 /src/synproto.c
parent0054b144f3daf00e46a35b2f165befb209df94fc (diff)
Reset hw->x/y to INT_MIN and skip HandleState until we have x/y events
The driver assumes x/y is always valid but after coming from a resume we may get a few events with either ABS_X or ABS_Y (not both). Thus we process with hw->x == 0 and hw->y == somevalue, causing cursor jumps when calculating deltas whenver the real hw->x comes in. Fix this by resetting hw->x/y to INT_MIN and skip state processing until both axes are available. For clickpads, this means handling of data will be delayed until we get at least one motion on each axis. Button presses won't be recognised either until that happens. It requires some skill to not trigger motion on both axes, even more to press a button without doing so. For non-clickpads, handling of motion events will be delayed likewise. If a physical button is pressed immediately after resume we have to assume deltas of x/y. - If the next event is a new touch, it will have ABS_X/ABS_Y set anyway - If the finger was already down, a button event is generated, and the finger has generated ABS_X or ABS_Y only before the event, the next event containing the missing data will cause a jump. The fix for this is more invasive and this is quite a corner-case. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Diffstat (limited to 'src/synproto.c')
-rw-r--r--src/synproto.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/synproto.c b/src/synproto.c
index d3f05ca..91e20e6 100644
--- a/src/synproto.c
+++ b/src/synproto.c
@@ -123,8 +123,8 @@ void
SynapticsResetHwState(struct SynapticsHwState *hw)
{
hw->millis = 0;
- hw->x = 0;
- hw->y = 0;
+ hw->x = INT_MIN;
+ hw->y = INT_MIN;
hw->z = 0;
hw->cumulative_dx = 0;
hw->cumulative_dy = 0;