Reset stale touchpad contacts after interrupted input

This commit is contained in:
ajp_anton
2026-09-07 19:47:28 +00:00
parent a8d68238bd
commit 93607d749f
3 changed files with 58 additions and 6 deletions
@@ -307,6 +307,37 @@ function tests.rejected_tap_does_not_poison_anchor()
up(device, 300000, 0, 0)
end
function tests.empty_touch_state_clears_stale_contacts()
local device = new_device("touchpad")
-- A suspend may interrupt the stream without individual tracking-ID
-- releases. The following no-touch report must still reset the plugin.
down(device, 0, 1, 70, 1000, 1000, 1)
feed(device, 100000, {
event(evdev.BTN_TOUCH, 0),
event(evdev.BTN_TOOL_FINGER, 0),
})
down(device, 200000, 0, 71, 1000, 1000, 1)
down(device, 400000, 1, 72, 1400, 1000, 2)
up(device, 450000, 1, 1)
assert(action_count() == 1)
up(device, 500000, 0, 0)
end
function tests.reused_slot_clears_stale_contacts()
local device = new_device("touchpad")
down(device, 0, 0, 73, 1000, 1000, 1)
-- A new tracking ID in an occupied slot also proves that the previous
-- contact disappeared without a complete event sequence.
down(device, 200000, 0, 74, 1000, 1000, 1)
down(device, 400000, 1, 75, 1400, 1000, 2)
up(device, 450000, 1, 1)
assert(action_count() == 1)
up(device, 500000, 0, 0)
end
function tests.tap_while_moving_does_not_poison_anchor()
if allow_moving_anchor then
return