From 147d5fb9256aa54ed5321bc2c6f7beacbfebaa77 Mon Sep 17 00:00:00 2001 From: Josh Date: Fri, 13 Nov 2026 15:18:09 -0500 Subject: [PATCH] Keep Roku remote focus on the tuner and guide --- roku/components/Guide.brs | 4 ++-- roku/components/RetroScene.brs | 18 ++++++++++++++++-- roku/components/RetroScene.xml | 5 +++-- roku/components/Weather.brs | 2 ++ 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/roku/components/Guide.brs b/roku/components/Guide.brs index 2001c51..efbb96f 100644 --- a/roku/components/Guide.brs +++ b/roku/components/Guide.brs @@ -13,7 +13,7 @@ sub showPanel(mode as string, title as string, status as string, titles as objec m.menu.jumpToItem = 0 m.panel.visible = true if titles.Count() = 0 - m.top.SetFocus(true) + m.remoteFocus.SetFocus(true) else m.menu.SetFocus(true) end if @@ -22,7 +22,7 @@ end sub sub closePanel() m.panelMode = "" m.panel.visible = false - m.top.SetFocus(true) + m.remoteFocus.SetFocus(true) end sub sub onMenuSelect(event as object) diff --git a/roku/components/RetroScene.brs b/roku/components/RetroScene.brs index a9d1555..f2b3783 100644 --- a/roku/components/RetroScene.brs +++ b/roku/components/RetroScene.brs @@ -1,5 +1,5 @@ sub init() - for each id in ["video", "weather", "banner", "channelTitle", "clock", "nowTitle", "nextTitle", "progressTrack", "progress", "playbackStatus", "panel", "panelTitle", "panelStatus", "menu", "bannerTimer", "clockTimer", "retryTimer", "guideDetails", "guideChannelTitle", "guideNow", "guideNext", "guideLater"] + for each id in ["video", "weather", "banner", "channelTitle", "clock", "nowTitle", "nextTitle", "progressTrack", "progress", "playbackStatus", "panel", "panelTitle", "panelStatus", "menu", "bannerTimer", "clockTimer", "retryTimer", "guideDetails", "guideChannelTitle", "guideNow", "guideNext", "guideLater", "remoteFocus"] m[id] = m.top.FindNode(id) end for m.channels = [] @@ -189,6 +189,7 @@ sub playLinear(channel as object) m.video.content = content m.videoChannelId = channel.id m.video.control = "play" + restoreRemoteFocus() end sub sub refreshSchedule() @@ -288,7 +289,17 @@ sub setPlaybackStatus(message as string) m.playbackStatus.visible = true end sub +sub restoreRemoteFocus() + if m.top.dialog <> invalid and m.top.dialog.IsInFocusChain() then return + if m.panel.visible and m.menu.content <> invalid and m.menu.content.GetChildCount() > 0 + if not m.menu.HasFocus() then m.menu.SetFocus(true) + else if not m.remoteFocus.HasFocus() + m.remoteFocus.SetFocus(true) + end if +end sub + sub onVideoState() + restoreRemoteFocus() if m.weather.visible if m.video.state = "error" or m.video.state = "finished" then hideWeatherPreview() return @@ -320,7 +331,7 @@ function onKeyEvent(key as string, press as boolean) as boolean closePanel() return true end if - if key = "options" and m.channels.Count() > 0 + if key = "options" and (m.channelIndex >= 0 or m.panelMode = "guide" or m.panelMode = "options") if m.panelMode = "guide" showPanel("options", "retroLabs", m.server.name + " " + m.server.baseUrl, ["Program guide", "Refresh channels", "Change server"]) else @@ -335,6 +346,9 @@ function onKeyEvent(key as string, press as boolean) as boolean if key = "up" then direction = -1 openGuide(direction) return true + else if key = "right" + openGuide() + return true else if key = "left" or key = "replay" if m.previousIndex >= 0 then tune(m.previousIndex) return true diff --git a/roku/components/RetroScene.xml b/roku/components/RetroScene.xml index dcd8abb..db7b572 100644 --- a/roku/components/RetroScene.xml +++ b/roku/components/RetroScene.xml @@ -4,7 +4,8 @@