Reset stale touchpad contacts after interrupted input
This commit is contained in:
@@ -153,13 +153,18 @@ local function emit_action()
|
||||
return true
|
||||
end
|
||||
|
||||
local function reset_contacts(state)
|
||||
state.mode = "idle"
|
||||
state.contacts = {}
|
||||
state.anchor_slot = nil
|
||||
state.candidate_slot = nil
|
||||
state.candidate_anchor_x = nil
|
||||
state.candidate_anchor_y = nil
|
||||
end
|
||||
|
||||
local function reset_if_clear(state)
|
||||
if contact_count(state, false) == 0 then
|
||||
state.mode = "idle"
|
||||
state.anchor_slot = nil
|
||||
state.candidate_slot = nil
|
||||
state.candidate_anchor_x = nil
|
||||
state.candidate_anchor_y = nil
|
||||
reset_contacts(state)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -178,6 +183,12 @@ local function new_contact(state, slot, tracking_id, timestamp)
|
||||
end
|
||||
|
||||
local function handle_tracking_begin(device, state, tracking_id, timestamp)
|
||||
if state.contacts[state.source_slot] then
|
||||
libinput:log_debug(
|
||||
"touchpad-hold-tap: resetting stale contact state")
|
||||
reset_contacts(state)
|
||||
end
|
||||
|
||||
if state.mode == "candidate" then
|
||||
restore_candidate(device, state, "extra contact")
|
||||
end
|
||||
@@ -361,6 +372,13 @@ local function handle_frame(device, frame, timestamp)
|
||||
else
|
||||
modified = true
|
||||
end
|
||||
elseif event.usage == evdev.BTN_TOUCH and event.value == 0 then
|
||||
table.insert(output, event)
|
||||
if contact_count(state, false) > 0 then
|
||||
libinput:log_debug(
|
||||
"touchpad-hold-tap: resetting empty touch state")
|
||||
reset_contacts(state)
|
||||
end
|
||||
elseif tool_counts[event.usage] then
|
||||
if state.mode == "candidate" or override_tools then
|
||||
local desired = tool_counts[event.usage] ==
|
||||
|
||||
Reference in New Issue
Block a user