InputContainer/FocusManager: Simplify key_events clearing on unplug

Thanks to @poire-z for the idea, it's indeed much nicer this way ;).
This commit is contained in:
NiLuJe
2022-11-01 23:22:07 +01:00
parent d585cd5d86
commit 925fd647dc
19 changed files with 66 additions and 141 deletions

View File

@@ -305,4 +305,13 @@ function InputContainer:closeInputDialog()
UIManager:close(self.input_dialog)
end
function InputContainer:onPhysicalKeyboardDisconnected()
-- Clear the key bindings if Device no longer has keys
-- NOTE: hasKeys is the lowest common denominator of key-related Device caps,
-- hasDPad/hasFewKeys/hasKeyboard all imply hasKeys ;).
if not Device:hasKeys() then
self.key_events = {}
end
end
return InputContainer