mirror of
https://github.com/SteamDeckHomebrew/decky-frontend-lib.git
synced 2026-05-19 17:40:08 +02:00
fix(findSP): fallback to last active context (#53)
This commit is contained in:
@@ -6,7 +6,8 @@ declare global {
|
||||
|
||||
function getQuickAccessWindow(): Window | null {
|
||||
try {
|
||||
const navTrees = FocusNavController?.m_ActiveContext?.m_rgGamepadNavigationTrees || FocusNavController?.m_rgGamepadNavigationTrees;
|
||||
const context = FocusNavController?.m_ActiveContext || FocusNavController?.m_LastActiveContext;
|
||||
const navTrees = context?.m_ActiveContext?.m_rgGamepadNavigationTrees || FocusNavController?.m_rgGamepadNavigationTrees;
|
||||
return navTrees?.find((tree: any) => tree?.id === "QuickAccess-NA")?.m_Root?.m_element?.ownerDocument.defaultView ?? null;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
|
||||
@@ -16,6 +16,7 @@ export function findSP(): Window {
|
||||
// old (SP as host)
|
||||
if (document.title == 'SP') return window;
|
||||
// new (SP as popup)
|
||||
return FocusNavController.m_ActiveContext.m_rgGamepadNavigationTrees.find((x: any) => x.m_ID == 'root_1_').Root
|
||||
const context = FocusNavController.m_ActiveContext || FocusNavController.m_LastActiveContext;
|
||||
return context.m_rgGamepadNavigationTrees.find((x: any) => x.m_ID == 'root_1_').Root
|
||||
.Element.ownerDocument.defaultView;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user