summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChase Douglas <chase.douglas@canonical.com>2012-05-14 10:20:01 -0700
committerPeter Hutterer <peter.hutterer@who-t.net>2012-05-16 11:52:35 +1000
commit23e87b57bb874326c88a7ad7292bec51959fb876 (patch)
tree0e75595ed10836df9be22b23eaa2e3e39877a306
parent23065a974e5dcdf0d6a436a0547bb7887d306a6f (diff)
Ignore pre-existing touches
If a touch is physically active when the device is enabled, then all events for that touch must be ignored. In particular, we cannot close the touch or we will decrement touch count counters below zero. If these counters go below zero memory corruption can occur. Note that a device is disabled and enabled every time the user types on the keyboard if synclient is used to disable the trackpad while typing. This is a very common option. Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> (cherry picked from commit 55fc42e7c9b4948cadd4f98ef7b6a3b12e268e3e)
-rw-r--r--src/eventcomm.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/eventcomm.c b/src/eventcomm.c
index 89a8a3a..280ef9b 100644
--- a/src/eventcomm.c
+++ b/src/eventcomm.c
@@ -564,8 +564,7 @@ EventProcessTouchEvent(InputInfoPtr pInfo, struct SynapticsHwState *hw,
if (slot_index < 0)
return;
- if (hw->slot_state[slot_index] == SLOTSTATE_EMPTY ||
- hw->slot_state[slot_index] == SLOTSTATE_OPEN_EMPTY)
+ if (hw->slot_state[slot_index] == SLOTSTATE_OPEN_EMPTY)
hw->slot_state[slot_index] = SLOTSTATE_UPDATE;
if (ev->code == ABS_MT_TRACKING_ID) {
if (ev->value >= 0) {
@@ -580,7 +579,7 @@ EventProcessTouchEvent(InputInfoPtr pInfo, struct SynapticsHwState *hw,
"Attempted to copy values from out-of-range "
"slot, touch events may be incorrect.\n");
}
- else {
+ else if (hw->slot_state[slot_index] != SLOTSTATE_EMPTY) {
hw->slot_state[slot_index] = SLOTSTATE_CLOSE;
proto_data->num_touches--;
}