Introduce Device:useDPadAsActionKeys() (#11900)

1. Non-Kindle-specific `hasFiveWay` behavior is changed to `hasDPad and useDPadAsActionKeys`. For now they remain Kindle-specific in practice, unless one sets `useDPadAsActionKeys = yes` in a user patch.
2. With that disambiguation out of the way, `hasFiveWay` itself is further disambiguated into `hasScreenKB` and `hasSymKey`, as per the actual property being used, rather than something that tends to correlate with it. (It needn't be Kindle-specific per se, but non-Kindle devices have equivalent shortcuts with for example `Shift`.)
  Running the emulator with `DISABLE_TOUCH=1` will set `hasSymKey = yes`, which can be tested with right shift.

Closes #11887.
This commit is contained in:
Frans de Jonge
2024-05-26 21:25:54 +02:00
committed by GitHub
parent 3fb2f18041
commit 8f2bd5420d
15 changed files with 56 additions and 53 deletions

View File

@@ -246,16 +246,12 @@ function ReaderHighlight:registerKeyEvents()
self.key_events.QuickLeftHighlightIndicator = { { "Shift", "Left" }, event = "MoveHighlightIndicator", args = {-1, 0, QUICK_INDICATOR_MOVE} }
self.key_events.QuickRightHighlightIndicator = { { "Shift", "Right" }, event = "MoveHighlightIndicator", args = {1, 0, QUICK_INDICATOR_MOVE} }
self.key_events.StartHighlightIndicator = { { "H" } }
if Device:hasFiveWay() then
self.key_events.KeyContentSelection = { { { "Up", "Down" } }, event = "StartHighlightIndicator" }
end
elseif Device:hasFiveWay() then
elseif Device:hasScreenKB() then
local QUICK_INDICATOR_MOVE = true
self.key_events.QuickUpHighlightIndicator = { { "ScreenKB", "Up" }, event = "MoveHighlightIndicator", args = {0, -1, QUICK_INDICATOR_MOVE} }
self.key_events.QuickDownHighlightIndicator = { { "ScreenKB", "Down" }, event = "MoveHighlightIndicator", args = {0, 1, QUICK_INDICATOR_MOVE} }
self.key_events.QuickLeftHighlightIndicator = { { "ScreenKB", "Left" }, event = "MoveHighlightIndicator", args = {-1, 0, QUICK_INDICATOR_MOVE} }
self.key_events.QuickRightHighlightIndicator = { { "ScreenKB", "Right" }, event = "MoveHighlightIndicator", args = {1, 0, QUICK_INDICATOR_MOVE} }
self.key_events.KeyContentSelection = { { { "Up", "Down" } }, event = "StartHighlightIndicator" }
end
end
@@ -377,7 +373,7 @@ local highlight_dialog_position = {
function ReaderHighlight:addToMainMenu(menu_items)
-- insert table to main reader menu
if not Device:isTouchDevice() and Device:hasDPad() and not Device:hasFiveWay() then
if not Device:isTouchDevice() and Device:hasDPad() and not Device:useDPadAsActionKeys() then
menu_items.start_content_selection = {
text = _("Start content selection"),
callback = function()