[PATCH xf86-input-synaptics] Ignore pre-existing touches

Chase Douglas chase.douglas at canonical.com
Mon May 14 10:20:01 PDT 2012


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 at canonical.com>
---
 src/eventcomm.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/eventcomm.c b/src/eventcomm.c
index d9430e1..8b6afb9 100644
--- a/src/eventcomm.c
+++ b/src/eventcomm.c
@@ -545,8 +545,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) {
@@ -561,7 +560,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--;
             }
-- 
1.7.9.5



More information about the xorg-devel mailing list