mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
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:
@@ -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