GestureDetector: Clear *all* pending hold states on hold_release.

We'll only honor one (the last one) anyway, and we've already cleared
the timers, so the others are essentially lost and stuck in limbo.

(Repro: do a series of staggered holds on different words with different
fingers in a CRe document; the one that'll "take" is the last one,
but *every* slot will be stuck in a hold state, which can essentially
semi lock you into broken input until you manage to clear the right
slots by doing duplicate multi-slot holds again...).
pull/9441/head
NiLuJe 2 years ago
parent e3228abb19
commit 3768aa0b56

@ -395,8 +395,8 @@ function GestureDetector:tapState(tev)
self:probeClockSource(tev.timev)
end
logger.dbg("in tap state...")
local slot = tev.slot
logger.dbg("slot", slot, "in tap state...")
if tev.id == -1 then
local s1 = self.input.main_finger_slot
local s2 = self.input.main_finger_slot + 1
@ -563,8 +563,8 @@ function GestureDetector:handleNonTap(tev)
end
function GestureDetector:panState(tev)
logger.dbg("in pan state...")
local slot = tev.slot
logger.dbg("slot", slot, "in pan state...")
if tev.id == -1 then
-- end of pan, signal swipe gesture if necessary
if self:isSwipe(slot) then
@ -816,8 +816,8 @@ function GestureDetector:handlePanRelease(tev)
end
function GestureDetector:holdState(tev, hold)
logger.dbg("in hold state...")
local slot = tev.slot
logger.dbg("slot", slot, "in hold state...")
-- When we switch to hold state, we pass an additional boolean param "hold".
if tev.id ~= -1 and hold and self.last_tevs[slot].x and self.last_tevs[slot].y then
self.states[slot] = self.holdState
@ -835,7 +835,8 @@ function GestureDetector:holdState(tev, hold)
logger.dbg("hold_release detected in slot", slot)
local last_x = self.last_tevs[slot].x
local last_y = self.last_tevs[slot].y
self:clearState(slot)
-- NOTE: Don't leave multiple slots "stuck" in hold state, as we've cleared their timeouts in the main input loop anyway.
self:clearStates()
return {
ges = "hold_release",
pos = Geom:new{

Loading…
Cancel
Save