2
0
mirror of https://github.com/koreader/koreader synced 2024-11-18 03:25:46 +00:00

Input: Don't re-run the slot creation check on key sets

Make sure we always create the storage table when we add its reference
to the MTSlots list instead.

(The reasoning being we only add the reference once, and it's the first
thing we do, and we kinda need the storage to be created to get its
reference anyway; while we may set multiple keys per frame).
This commit is contained in:
NiLuJe 2022-08-14 03:45:29 +02:00
parent ba43ac1833
commit 36d0bcc703

View File

@ -815,7 +815,7 @@ function Input:handleTouchEvLegacy(ev)
-- In those devices the 'handleTouchEv' function doesn't work as expected. Use this function instead.
if ev.type == C.EV_ABS then
if #self.MTSlots == 0 then
table.insert(self.MTSlots, self:getMtSlot(self.cur_slot))
self:addSlot(self.cur_slot)
end
if ev.code == C.ABS_X then
self:setCurrentMtSlot("x", ev.value)
@ -989,8 +989,6 @@ function Input:initMtSlot(slot)
end
function Input:setMtSlot(slot, key, val)
self:initMtSlot(slot)
self.ev_slots[slot][key] = val
end