diff options
author | Chase Douglas <chase.douglas@canonical.com> | 2012-01-19 14:17:34 -0800 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2012-01-24 12:12:47 +1000 |
commit | bc2f01ab838119a962f5e5eabb36e33d4c084f2c (patch) | |
tree | 2c86358d5ccef287aade55d93d1823925e048cb8 /src/evdev.h | |
parent | 9d9c9870c88f2c636799a68cde8efcab59a4a2a5 (diff) |
Copy last valuator values into new touch valuator masks
Evdev is a 100% stateful protocol. The following represents three
touches. Two touches begin and end at the same time at (500, 500) and
(1000, 1000). The third touch begins after the first two end, and is at
(500, 500).
ABS_MT_SLOT 0 /* Set touch slot */
ABS_MT_TRACKING_ID 0 /* New touch with ID 0 in slot 0 */
ABS_MT_POSITION_X 500 /* Initial X position */
ABS_MT_POSITION_Y 500 /* Initial Y position */
ABS_MT_SLOT 1 /* Set touch slot */
ABS_MT_TRACKING_ID 1 /* New touch with ID 1 in slot 1 */
ABS_MT_POSITION_X 1000 /* Initial X position */
ABS_MT_POSITION_Y 1000 /* Initial Y position */
SYNC /* End of frame */
ABS_MT_SLOT 0 /* Go back to slot 0 */
ABS_MT_TRACKING_ID -1 /* Touch in slot 0 ended */
ABS_MT_SLOT 1 /* Go to slot 1 */
ABS_MT_TRACKING_ID -1 /* Touch in slot 1 ended */
SYNC /* End of frame */
ABS_MT_SLOT 0 /* Go back to slot 0 */
ABS_MT_TRACKING_ID 2 /* New touch in slot 0 with ID 2 */
SYNC /* End of frame */
ABS_MT_TRACKING_ID -1 /* Touch in last slot (0) ended */
SYNC /* End of frame */
Note that touch 2 has the same X and Y position as touch 0. This is
implied because no new value was emitted for slot 0. In fact, Linux will
not emit an event in the same slot with the same event type and code
unless the value has changed. Thus, we can only assume that all the MT
valuators have the same values as they were when they were last sent for
the given slot.
This change adds an array of valuator mask to hold all the last valuator
values that came from evdev for each slot. When a new touch begins, all
the last values are copied into it.
This patch assumes initial axis values of 0 in each slot. Linux and
mtdev do not provide a facility to query the current values of axes in
each slot yet. This may cause spurious incorrect touch valuator values
at the beginning of an X session, but there's nothing we can do about it
right now.
Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'src/evdev.h')
-rw-r--r-- | src/evdev.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/evdev.h b/src/evdev.h index 1713b89..309b215 100644 --- a/src/evdev.h +++ b/src/evdev.h @@ -158,6 +158,7 @@ typedef struct { ValuatorMask *old_vals; /* old values for calculating relative motion */ ValuatorMask *prox; /* last values set while not in proximity */ ValuatorMask *mt_mask; + ValuatorMask **last_mt_vals; int cur_slot; enum SlotState slot_state; #ifdef MULTITOUCH |