mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Input: Allow disabling rotation_map entirely
(This involves moving it to the instance object to avoid inheritance). Pocketbook: Disable rotation_map on the Era (fix #9556) It would appear that InkView handles the translation for us, now...
This commit is contained in:
@@ -184,13 +184,8 @@ local Input = {
|
||||
UsbDevicePlugIn = true, UsbDevicePlugOut = true,
|
||||
},
|
||||
|
||||
-- NOTE: When looking at the device in Portrait mode, that's assuming PgBack is on TOP, and PgFwd on the BOTTOM
|
||||
rotation_map = {
|
||||
[framebuffer.ORIENTATION_PORTRAIT] = {},
|
||||
[framebuffer.ORIENTATION_LANDSCAPE] = { Up = "Right", Right = "Down", Down = "Left", Left = "Up", LPgBack = "LPgFwd", LPgFwd = "LPgBack", RPgBack = "RPgFwd", RPgFwd = "RPgBack" },
|
||||
[framebuffer.ORIENTATION_PORTRAIT_ROTATED] = { Up = "Down", Right = "Left", Down = "Up", Left = "Right", LPgFwd = "LPgBack", LPgBack = "LPgFwd", RPgFwd = "RPgBack", RPgBack = "RPgFwd" },
|
||||
[framebuffer.ORIENTATION_LANDSCAPE_ROTATED] = { Up = "Left", Right = "Up", Down = "Right", Left = "Down" }
|
||||
},
|
||||
-- This might be overloaded or even disabled (post-init) at instance-level, so we don't want any inheritance
|
||||
rotation_map = nil, -- nil or a hash
|
||||
|
||||
timer_callbacks = nil, -- instance-specific table, because the object may get destroyed & recreated at runtime
|
||||
disable_double_tap = true,
|
||||
@@ -256,6 +251,16 @@ function Input:init()
|
||||
input = self,
|
||||
}
|
||||
|
||||
-- NOTE: When looking at the device in Portrait mode, that's assuming PgBack is on TOP, and PgFwd on the BOTTOM
|
||||
if not self.rotation_map then
|
||||
self.rotation_map = {
|
||||
[framebuffer.ORIENTATION_PORTRAIT] = {},
|
||||
[framebuffer.ORIENTATION_LANDSCAPE] = { Up = "Right", Right = "Down", Down = "Left", Left = "Up", LPgBack = "LPgFwd", LPgFwd = "LPgBack", RPgBack = "RPgFwd", RPgFwd = "RPgBack" },
|
||||
[framebuffer.ORIENTATION_PORTRAIT_ROTATED] = { Up = "Down", Right = "Left", Down = "Up", Left = "Right", LPgFwd = "LPgBack", LPgBack = "LPgFwd", RPgFwd = "RPgBack", RPgBack = "RPgFwd" },
|
||||
[framebuffer.ORIENTATION_LANDSCAPE_ROTATED] = { Up = "Left", Right = "Up", Down = "Right", Left = "Down" }
|
||||
}
|
||||
end
|
||||
|
||||
-- set up fake event map
|
||||
self.event_map[10000] = "IntoSS" -- go into screen saver
|
||||
self.event_map[10001] = "OutOfSS" -- go out of screen saver
|
||||
@@ -534,8 +539,11 @@ function Input:handleKeyBoardEv(ev)
|
||||
end
|
||||
|
||||
-- take device rotation into account
|
||||
if self.rotation_map[self.device.screen:getRotationMode()][keycode] then
|
||||
keycode = self.rotation_map[self.device.screen:getRotationMode()][keycode]
|
||||
if self.rotation_map then
|
||||
local rota = self.device.screen:getRotationMode()
|
||||
if self.rotation_map[rota][keycode] then
|
||||
keycode = self.rotation_map[rota][keycode]
|
||||
end
|
||||
end
|
||||
|
||||
if self.fake_event_set[keycode] then
|
||||
|
||||
@@ -62,6 +62,10 @@ local PocketBook = Generic:extend{
|
||||
--- @fixme: Never actually set anywhere?
|
||||
is_using_raw_input = nil,
|
||||
|
||||
-- InkView may have started translating button codes based on rotation on newer devices...
|
||||
-- That historically wasn't the case, hence this defaulting to false.
|
||||
inkview_translates_buttons = false,
|
||||
|
||||
-- Will be set appropriately at init
|
||||
isB288SoC = no,
|
||||
|
||||
@@ -216,6 +220,11 @@ function PocketBook:init()
|
||||
end,
|
||||
}
|
||||
|
||||
-- If InkView translates buttons for us, disable our own translation map
|
||||
if self.inkview_translates_buttons then
|
||||
self.input.rotation_map = nil
|
||||
end
|
||||
|
||||
-- in contrast to kobo/kindle, pocketbook-devices do not use linux/input
|
||||
-- events directly. To be able to use input.lua nevertheless, we make
|
||||
-- inkview-events look like linux/input events or handle them directly
|
||||
@@ -593,6 +602,8 @@ local PocketBook700 = PocketBook:extend{
|
||||
display_dpi = 300,
|
||||
isAlwaysPortrait = yes,
|
||||
hasNaturalLight = yes,
|
||||
-- c.f., https://github.com/koreader/koreader/issues/9556
|
||||
inkview_translates_buttons = true,
|
||||
}
|
||||
|
||||
-- PocketBook InkPad 3 (740)
|
||||
|
||||
Reference in New Issue
Block a user