From 8aa7b93d7c0e02bb730060aae1e489e7cbcccc2d Mon Sep 17 00:00:00 2001 From: David <97603719+Commodore64user@users.noreply.github.com> Date: Sun, 23 Aug 2026 14:39:24 +0100 Subject: [PATCH] [FootnoteWidget]: NT use buttons to move to prev/next footnote (#15911) --- frontend/apps/reader/modules/readerlink.lua | 9 ++++++++ frontend/ui/widget/footnotewidget.lua | 24 +++++++++++++++++---- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/frontend/apps/reader/modules/readerlink.lua b/frontend/apps/reader/modules/readerlink.lua index dec27b691..32391eedf 100644 --- a/frontend/apps/reader/modules/readerlink.lua +++ b/frontend/apps/reader/modules/readerlink.lua @@ -1611,6 +1611,15 @@ function ReaderLink:showAsFootnotePopup(link, neglect_current_location) end self._footnote_popup_discard_previous_close_callback = nil end, + navigate_footnote_callback = function(direction) + UIManager:close(popup) + if direction > 0 then + self:onSelectNextPageLink() + else + self:onSelectPrevPageLink() + end + self:onGotoSelectedPageLink() + end, dialog = self.dialog, } UIManager:show(popup) diff --git a/frontend/ui/widget/footnotewidget.lua b/frontend/ui/widget/footnotewidget.lua index b4c4e4558..d931c60de 100644 --- a/frontend/ui/widget/footnotewidget.lua +++ b/frontend/ui/widget/footnotewidget.lua @@ -134,6 +134,7 @@ local FootnoteWidget = InputContainer:extend{ follow_callback = nil, on_tap_close_callback = nil, close_callback = nil, + navigate_footnote_callback = nil, dialog = nil, covers_footer = true, } @@ -203,10 +204,13 @@ function FootnoteWidget:init() } end if Device:hasKeys() then - self.key_events = { - Close = { { Device.input.group.Back } }, - Follow = { { "Press" } }, - } + self.key_events.Close = { { Device.input.group.Back } } + self.key_events.Follow = { { "Press" } } + if Device:hasScreenKB() or Device:hasKeyboard() then + local modifier = Device:hasScreenKB() and "ScreenKB" or "Shift" + self.key_events.NextFootnote = { { modifier, Device.input.group.PgFwd } } + self.key_events.PrevFootnote = { { modifier, Device.input.group.PgBack } } + end end -- Workaround bugs in MuPDF: @@ -411,6 +415,18 @@ function FootnoteWidget:onFollow() end end +function FootnoteWidget:onNextFootnote() + if not self.navigate_footnote_callback then return false end + self.navigate_footnote_callback(1) + return true +end + +function FootnoteWidget:onPrevFootnote() + if not self.navigate_footnote_callback then return false end + self.navigate_footnote_callback(-1) + return true +end + function FootnoteWidget:onTapClose(arg, ges) if ges.pos:notIntersectWith(self.container.dimen) then UIManager:close(self)