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:
1 parent
d585cd5d86
commit
925fd647dc
19 files changed
+66
-141
No files matched your search
@@ -8,14 +8,14 @@ local ReaderRotation = InputContainer:extend{
|
||||
}
|
||||
|
||||
function ReaderRotation:init()
|
||||
self:registerKeyEvents(true)
|
||||
self:registerKeyEvents()
|
||||
-- NOP our own gesture handling
|
||||
self.ges_events = nil
|
||||
end
|
||||
|
||||
function ReaderRotation:onGesture() end
|
||||
|
||||
function ReaderRotation:registerKeyEvents(init)
|
||||
function ReaderRotation:registerKeyEvents()
|
||||
if Device:hasKeyboard() then
|
||||
self.key_events = {
|
||||
-- these will all generate the same event, just with different arguments
|
||||
@@ -30,13 +30,10 @@ function ReaderRotation:registerKeyEvents(init)
|
||||
args = 90
|
||||
},
|
||||
}
|
||||
elseif not init then
|
||||
self.key_events = {}
|
||||
end
|
||||
end
|
||||
|
||||
ReaderRotation.onPhysicalKeyboardConnected = ReaderRotation.registerKeyEvents
|
||||
ReaderRotation.onPhysicalKeyboardDisconnected = ReaderRotation.registerKeyEvents
|
||||
|
||||
--- @todo Reset rotation on new document, maybe on new page?
|
||||
|
||||
|
||||
Reference in new issue
Block a user