diff --git a/frontend/apps/reader/modules/readerpaging.lua b/frontend/apps/reader/modules/readerpaging.lua index 3bf67199e..6e010ee7f 100644 --- a/frontend/apps/reader/modules/readerpaging.lua +++ b/frontend/apps/reader/modules/readerpaging.lua @@ -51,7 +51,38 @@ end function ReaderPaging:onGesture() end function ReaderPaging:registerKeyEvents() - if Device:hasKeys() then + if Device:hasPageUpDownKeys() and Device:hasDPad() then + self.key_events.GotoNextPage = { + { { "RPgFwd", "LPgFwd" } }, + event = "GotoViewRel", + args = 1, + } + self.key_events.GotoPrevPage = { + { { "RPgBack", "LPgBack" } }, + event = "GotoViewRel", + args = -1, + } + self.key_events.GotoNextPos = { + { "Down" }, + event = "GotoPosRel", + args = 1, + } + self.key_events.GotoPrevPos = { + { "Up" }, + event = "GotoPosRel", + args = -1, + } + self.key_events.GotoNextChapter = { + { "Right" }, + event = "GotoNextChapter", + args = 1, + } + self.key_events.GotoPrevChapter = { + { "Left" }, + event = "GotoPrevChapter", + args = -1, + } + elseif Device:hasKeys() then self.key_events.GotoNextPage = { { { "RPgFwd", "LPgFwd", not Device:hasFewKeys() and "Right" } }, event = "GotoViewRel", diff --git a/frontend/apps/reader/modules/readerrolling.lua b/frontend/apps/reader/modules/readerrolling.lua index 205c72cff..bfed552fe 100644 --- a/frontend/apps/reader/modules/readerrolling.lua +++ b/frontend/apps/reader/modules/readerrolling.lua @@ -116,7 +116,18 @@ end function ReaderRolling:onGesture() end function ReaderRolling:registerKeyEvents() - if Device:hasKeys() then + if Device:hasPageUpDownKeys() and Device:hasDPad() then + self.key_events.GotoNextView = { + { { "RPgFwd", "LPgFwd" } }, + event = "GotoViewRel", + args = 1, + } + self.key_events.GotoPrevView = { + { { "RPgBack", "LPgBack" } }, + event = "GotoViewRel", + args = -1, + } + elseif Device:hasKeys() then self.key_events.GotoNextView = { { { "RPgFwd", "LPgFwd", "Right" } }, event = "GotoViewRel", @@ -128,7 +139,22 @@ function ReaderRolling:registerKeyEvents() args = -1, } end - if Device:hasDPad() then + if Device:hasPageUpDownKeys() and Device:hasDPad() then + self.key_events.ContentSelection = { + { { "Up", "Down" } }, + event = "ContentSelection", + } + self.key_events.GotoNextChapter = { + { "Right" }, + event = "GotoNextChapter", + args = 1, + } + self.key_events.GotoPrevChapter = { + { "Left" }, + event = "GotoPrevChapter", + args = -1, + } + elseif Device:hasDPad() then self.key_events.MoveUp = { { "Up" }, event = "Panning", @@ -780,6 +806,10 @@ function ReaderRolling:onGotoPrevChapter() return true end +function ReaderRolling:onContentSelection() + return self.ui.highlight:onStartHighlightIndicator() +end + function ReaderRolling:onNotCharging() self:updateBatteryState() end diff --git a/frontend/apps/reader/modules/readertoc.lua b/frontend/apps/reader/modules/readertoc.lua index aaae68833..bd6bc9987 100644 --- a/frontend/apps/reader/modules/readertoc.lua +++ b/frontend/apps/reader/modules/readertoc.lua @@ -62,6 +62,8 @@ function ReaderToc:onGesture() end function ReaderToc:registerKeyEvents() if Device:hasKeyboard() then self.key_events.ShowToc = { { "T" } } + elseif Device:hasPageUpDownKeys() and Device:hasDPad() then + self.key_events.ShowToc = { { "ScreenKB" } } end end diff --git a/frontend/device/generic/device.lua b/frontend/device/generic/device.lua index a2f24426c..79b0e24b1 100644 --- a/frontend/device/generic/device.lua +++ b/frontend/device/generic/device.lua @@ -41,6 +41,7 @@ local Device = { hasAuxBattery = no, hasKeyboard = no, hasKeys = no, + hasPageUpDownKeys = no, canKeyRepeat = no, hasDPad = no, hasExitOptions = yes, diff --git a/frontend/device/kindle/device.lua b/frontend/device/kindle/device.lua index f93bb17f7..ef2d1a6f5 100644 --- a/frontend/device/kindle/device.lua +++ b/frontend/device/kindle/device.lua @@ -458,6 +458,7 @@ local Kindle2 = Kindle:extend{ isREAGL = no, hasKeyboard = yes, hasKeys = yes, + hasPageUpDownKeys = yes, hasDPad = yes, canHWInvert = no, canModifyFBInfo = no, @@ -471,6 +472,7 @@ local KindleDXG = Kindle:extend{ isREAGL = no, hasKeyboard = yes, hasKeys = yes, + hasPageUpDownKeys = yes, hasDPad = yes, canHWInvert = no, canModifyFBInfo = no, @@ -484,6 +486,7 @@ local Kindle3 = Kindle:extend{ isREAGL = no, hasKeyboard = yes, hasKeys = yes, + hasPageUpDownKeys = yes, hasDPad = yes, canHWInvert = no, canModifyFBInfo = no, @@ -495,6 +498,7 @@ local Kindle4 = Kindle:extend{ model = "Kindle4", isREAGL = no, hasKeys = yes, + hasPageUpDownKeys = yes, hasDPad = yes, canHWInvert = no, canModifyFBInfo = no, @@ -543,6 +547,7 @@ local KindleVoyage = Kindle:extend{ canTurnFrontlightOff = no, hasLightSensor = yes, hasKeys = yes, + hasPageUpDownKeys = yes, display_dpi = 300, touch_dev = "/dev/input/event1", } @@ -561,6 +566,7 @@ local KindleOasis = Kindle:extend{ isTouchDevice = yes, hasFrontlight = yes, hasKeys = yes, + hasPageUpDownKeys = yes, hasGSensor = yes, display_dpi = 300, --[[ @@ -579,6 +585,7 @@ local KindleOasis2 = Kindle:extend{ hasFrontlight = yes, hasLightSensor = yes, hasKeys = yes, + hasPageUpDownKeys = yes, hasGSensor = yes, display_dpi = 300, touch_dev = "/dev/input/by-path/platform-30a30000.i2c-event", @@ -593,6 +600,7 @@ local KindleOasis3 = Kindle:extend{ hasNaturalLightMixer = yes, hasLightSensor = yes, hasKeys = yes, + hasPageUpDownKeys = yes, hasGSensor = yes, display_dpi = 300, touch_dev = "/dev/input/by-path/platform-30a30000.i2c-event",