Use the live Steam UI size instead of hardcoded Deck dimensions - #19
Open
zomars wants to merge 1 commit into
Open
Use the live Steam UI size instead of hardcoded Deck dimensions#19zomars wants to merge 1 commit into
zomars wants to merge 1 commit into
Conversation
The screen was assumed to be 854x534, the Steam Deck's UI space. On any other display the Steam UI runs at a different logical size, so every position was computed inside an 854x534 box pinned to the top-left of the real screen. Only Top Left landed correctly; Top Right and the bottom positions ended up floating around the middle. Read the size off the main window each poll instead, falling back to the Deck values when it can't be read, and scale the picture and the virtual keyboard reservation to it. Also fixes two things that only showed up once the screen size was right: - The virtual keyboard was treated as visible whenever a 'virtual keyboard' navigation tree existed. Those trees are left behind on the main window after the keyboard closes, so the bottom of the screen was reserved permanently. Ask the keyboard manager instead. - The QAM's available area used SCREEN_WIDTH - qam.width. Its window can be wider than the slice of screen it actually covers, which made the area come out wrong or empty. Anchor on qam.x instead.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On anything that isn't Steam Deck hardware, every position except Top Left is wrong. Top Right lands near the middle of the screen, and the bottom positions float somewhere around a third of the way down. Closing the Quick Access menu doesn't correct it.
Cause
util.tsxhardcodes the screen as854x534, which is the Deck's own UI space:On other displays the Steam UI runs at a different logical size. On my Steam Machine driving a 4K TV it's
1348x758(DPR 2.85). So the layout is computed inside an 854x534 box pinned to the top-left corner of a much larger screen. Top Left is the only position anchored at the origin, which is why it's the only one that looks right.With
size: 0.7,margin: 60on a 1348-wide screen:794 out of 1348 is 59% across, i.e. visually centered.
Fix
Read the size off
GamepadUIMainWindowInstance.m_BrowserWindowon each poll and fall back to the Deck constants if it can't be read. The picture keeps its 40%-of-width sizing, so it stays proportional to the Deck's look. Since the size is part of the polled state, a resolution change re-lays-out on its own.Two smaller bugs surfaced once the dimensions were correct, both fixed here:
The virtual keyboard was always considered visible. Presence of a
virtual keyboardnavigation tree was used as the signal, but those trees are left behind on the main window after the keyboard closes — I count 13 stale ones on a running session — so!virtualKeyboardwas never true and the bottom 240px stayed reserved forever. Now it asksm_VirtualKeyboardManager.IsShowingVirtualKeyboard, and the reserved height scales with the screen.The QAM's available area used
SCREEN_WIDTH - qam.width. That window is often wider than the slice of screen it covers — mine reportsx: 1000, width: 855on a 1348-wide screen — so the subtraction produced a wrong or negative width, and the intersection collapsed to nothing and fell back to fullscreen. Anchoring onqam.xis correct regardless of how wide the window is.Testing
I don't have a working node toolchain on this machine, so I could not run
pnpm buildor typecheck this. Please treat the build as unverified.What I did verify: I applied the equivalent change directly to the built
dist/index.jsof the installed 1.0.0 plugin, hot-reloaded it, and hookedSetBoundson the pip browser view to record the geometry actually applied. On a 1348x758 UI atsize: 0.7,margin: 60, Top Right:1288 is exactly
1348 - 60. The 940 while the QAM is open is also correct — the picture tucks against the menu's left edge (qam.x1000, minus the margin) instead of being covered, and returns to 1288 when the menu closes.Only tested on one non-Deck screen size. It would be worth a sanity check on actual Deck hardware, where
getScreenSize()should simply return the same 854x534 the constants used to provide, making this a no-op there.