mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Add numerical key_codes to event_map on kindle 3 (#12358)
This commit is contained in:
@@ -67,7 +67,7 @@ function ReaderPaging:registerKeyEvents()
|
||||
self.key_events.GotoNextPos = { { "Down" }, event = "GotoPosRel", args = 1, }
|
||||
self.key_events.GotoPrevPos = { { "Up" }, event = "GotoPosRel", args = -1, }
|
||||
end
|
||||
if Device:hasKeyboard() then
|
||||
if Device:hasKeyboard() and not Device.k3_alt_plus_key_kernel_translated then
|
||||
self.key_events.GotoFirst = { { "1" }, event = "GotoPercent", args = 0, }
|
||||
self.key_events.Goto11 = { { "2" }, event = "GotoPercent", args = 11, }
|
||||
self.key_events.Goto22 = { { "3" }, event = "GotoPercent", args = 22, }
|
||||
|
||||
@@ -136,7 +136,7 @@ function ReaderRolling:registerKeyEvents()
|
||||
self.key_events.GotoNextView = { { { "RPgFwd", "LPgFwd", "Right" } }, event = "GotoViewRel", args = 1, }
|
||||
self.key_events.GotoPrevView = { { { "RPgBack", "LPgBack", "Left" } }, event = "GotoViewRel", args = -1, }
|
||||
end
|
||||
if Device:hasKeyboard() then
|
||||
if Device:hasKeyboard() and not Device.k3_alt_plus_key_kernel_translated then
|
||||
self.key_events.GotoFirst = { { "1" }, event = "GotoPercent", args = 0, }
|
||||
self.key_events.Goto11 = { { "2" }, event = "GotoPercent", args = 11, }
|
||||
self.key_events.Goto22 = { { "3" }, event = "GotoPercent", args = 22, }
|
||||
|
||||
@@ -40,6 +40,9 @@ end
|
||||
function ReaderWikipedia:registerKeyEvents()
|
||||
if Device:hasKeyboard() then
|
||||
self.key_events.ShowWikipediaLookup = { { "Alt", "W" }, { "Ctrl", "W" } }
|
||||
if Device.k3_alt_plus_key_kernel_translated then
|
||||
self.key_events.ShowWikipediaLookup = { { Device.k3_alt_plus_key_kernel_translated["W"] } }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1064,6 +1064,7 @@ function Kindle3:init()
|
||||
event_map = require("device/kindle/event_map_kindle4"),
|
||||
}
|
||||
self.keyboard_layout = require("device/kindle/keyboard_layout")
|
||||
self.k3_alt_plus_key_kernel_translated = dofile("frontend/device/kindle/k3_alt_and_top_row.lua")
|
||||
Kindle.init(self)
|
||||
end
|
||||
|
||||
|
||||
@@ -3,6 +3,10 @@ event map for Kindle devices on FW 3.x & 4.x
|
||||
--]]
|
||||
|
||||
return {
|
||||
-- NOTE: Although Kindle 3 does not have numerical keys, these key codes are still registered when pressing 'Alt'+'QWERTYUIOP'
|
||||
-- So, as far as kindle is concerned Alt+Q = 1, Alt+W = 2, ... Alt+P = 0
|
||||
[2] = "1", [3] = "2", [4] = "3", [5] = "4", [6] = "5", [7] = "6", [8] = "7", [9] = "8", [10] = "9", [11] = "0",
|
||||
-- Physical keys
|
||||
[16] = "Q", [17] = "W", [18] = "E", [19] = "R", [20] = "T", [21] = "Y", [22] = "U", [23] = "I", [24] = "O", [25] = "P",
|
||||
[30] = "A", [31] = "S", [32] = "D", [33] = "F", [34] = "G", [35] = "H", [36] = "J", [37] = "K", [38] = "L", [14] = "Del",
|
||||
[44] = "Z", [45] = "X", [46] = "C", [47] = "V", [48] = "B", [49] = "N", [50] = "M", [52] = ".",
|
||||
|
||||
13
frontend/device/kindle/k3_alt_and_top_row.lua
Normal file
13
frontend/device/kindle/k3_alt_and_top_row.lua
Normal file
@@ -0,0 +1,13 @@
|
||||
--[[
|
||||
Kindle's kernel designates Alt+'QWERTYUIOP' as numerical values on kindle 3.
|
||||
This map is intended to make shortcut writing more readable, for example Alt+W
|
||||
would be: self.key_events = { Device.k3_alt_plus_key_kernel_translated["W"] } instead of self.key_events = { "2" }
|
||||
--]]
|
||||
|
||||
return {
|
||||
["Q"] = {"1"}, ["W"] = {"2"},
|
||||
["E"] = {"3"}, ["R"] = {"4"},
|
||||
["T"] = {"5"}, ["Y"] = {"6"},
|
||||
["U"] = {"7"}, ["I"] = {"8"},
|
||||
["O"] = {"9"}, ["P"] = {"0"},
|
||||
}
|
||||
Reference in New Issue
Block a user