Compare commits

...

3 Commits

Author SHA1 Message Date
semantic-release-bot
8752f576a7 chore(release): 3.20.1 [CI SKIP] 2023-04-03 22:18:43 +00:00
TrainDoctor
102a441124 Merge pull request #79 from FrogTheFrog/main
fix(useQuickAccessVisible): make it work again
2023-04-03 15:18:07 -07:00
FrogTheFrog
7dacb23e8b fix(useQuickAccessVisible): make it work again 2023-03-19 22:25:53 +02:00
4 changed files with 22 additions and 16 deletions

View File

@@ -1,3 +1,10 @@
## [3.20.1](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.20.0...v3.20.1) (2023-04-03)
### Bug Fixes
* **useQuickAccessVisible:** make it work again ([7dacb23](https://github.com/SteamDeckHomebrew/decky-frontend-lib/commit/7dacb23e8be7b1f076cdd0869a4e3a3902b07ec5))
# [3.20.0](https://github.com/SteamDeckHomebrew/decky-frontend-lib/compare/v3.19.2...v3.20.0) (2023-04-03)

View File

@@ -1,6 +1,6 @@
{
"name": "decky-frontend-lib",
"version": "3.20.0",
"version": "3.20.1",
"description": "A library for building decky plugins",
"main": "dist/index.js",
"types": "dist/index.d.ts",

View File

@@ -1,17 +1,9 @@
import { useEffect, useState } from 'react';
import { getFocusNavController } from '../utils';
import { getGamepadNavigationTrees } from '../utils';
function getQuickAccessWindow(): Window | null {
try {
const navTrees = getFocusNavController()?.m_rgGamepadNavigationTrees;
return (
navTrees?.find((tree: any) => tree?.id === 'QuickAccess-NA')?.m_Root?.m_element?.ownerDocument.defaultView ?? null
);
} catch (error) {
console.error(error);
return null;
}
const navTrees = getGamepadNavigationTrees();
return navTrees.find((tree: any) => tree?.id === 'QuickAccess-NA')?.m_Root?.m_element?.ownerDocument.defaultView ?? null;
}
/**

View File

@@ -21,10 +21,8 @@ export function findSP(): Window {
// old (SP as host)
if (document.title == 'SP') return window;
// new (SP as popup)
const focusNav = getFocusNavController();
const context = focusNav.m_ActiveContext || focusNav.m_LastActiveContext;
return context.m_rgGamepadNavigationTrees.find((x: any) => x.m_ID == 'root_1_').Root.Element.ownerDocument
.defaultView;
const navTrees = getGamepadNavigationTrees();
return navTrees.find((x: any) => x.m_ID == 'root_1_').Root.Element.ownerDocument.defaultView;
}
/**
@@ -33,3 +31,12 @@ export function findSP(): Window {
export function getFocusNavController(): any {
return window.GamepadNavTree?.m_context?.m_controller || window.FocusNavController;
}
/**
* Gets the gamepad navigation trees as Valve seems to be moving them.
*/
export function getGamepadNavigationTrees(): any {
const focusNav = getFocusNavController();
const context = focusNav.m_ActiveContext || focusNav.m_LastActiveContext;
return context.m_rgGamepadNavigationTrees;
}