touchpad: reset the motion history during/after a slots->nfake crossover
Whenever we cross from N slots to at least one fake finger, reset the motion
history and skip the next event too. Especially on serial Synaptics touchpads,
the first touch update after a two-slot → TRIPLETAP is garbage, as is the one
from TRIPLETAP → two slots.
Example sequence reproduce on a T440s:
E: 4.488757 0003 003a 0084 # EV_ABS / ABS_MT_PRESSURE 84
E: 4.488757 0003 002f 0001 # EV_ABS / ABS_MT_SLOT 1
E: 4.488757 0003 0039 0433 # EV_ABS / ABS_MT_TRACKING_ID 433
E: 4.488757 0003 0035 2500 # EV_ABS / ABS_MT_POSITION_X 2500
E: 4.488757 0003 0036 3064 # EV_ABS / ABS_MT_POSITION_Y 3064
E: 4.488757 0003 003a 0060 # EV_ABS / ABS_MT_PRESSURE 60
E: 4.488757 0003 0018 0084 # EV_ABS / ABS_PRESSURE 84
E: 4.488757 0001 0145 0000 # EV_KEY / BTN_TOOL_FINGER 0
E: 4.488757 0001 014e 0001 # EV_KEY / BTN_TOOL_TRIPLETAP 1
E: 4.488757 0000 0000 0000 # ------------ SYN_REPORT (0) ----------
E: 4.508506 0003 002f 0000 # EV_ABS / ABS_MT_SLOT 0
E: 4.508506 0003 0036 2982 # EV_ABS / ABS_MT_POSITION_Y 2982
E: 4.508506 0003 003a 0086 # EV_ABS / ABS_MT_PRESSURE 86
E: 4.508506 0003 002f 0001 # EV_ABS / ABS_MT_SLOT 1
E: 4.508506 0003 0035 3464 # EV_ABS / ABS_MT_POSITION_X 3464
E: 4.508506 0003 0036 2716 # EV_ABS / ABS_MT_POSITION_Y 2716
E: 4.508506 0003 0001 2982 # EV_ABS / ABS_Y 2982
E: 4.508506 0003 0018 0086 # EV_ABS / ABS_PRESSURE 86
E: 4.508506 0000 0000 0000 # ------------ SYN_REPORT (0) ----------
subsequent events then hover around the 3464 mark, but that initial jump is
enough to cause a massive cursor jump.
https://bugs.freedesktop.org/show_bug.cgi?id=91352
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Hallelujah-expressed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>