From 36d0bcc703fa9d882730a0681f3c236714018c51 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Sun, 14 Aug 2022 03:45:29 +0200 Subject: [PATCH] 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). --- frontend/device/input.lua | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/frontend/device/input.lua b/frontend/device/input.lua index c7e770fd8..9c57cf633 100644 --- a/frontend/device/input.lua +++ b/frontend/device/input.lua @@ -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