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).
reviewable/pr9441/r1
NiLuJe 2 years ago
parent ba43ac1833
commit 36d0bcc703

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

Loading…
Cancel
Save