Repository navigation
topbar: fullscreen games keep fullscreen, also after Alt+Tab - #197
Open
pagliarinilucas wants to merge 1 commit into
Open
pagliarinilucas wants to merge 1 commit into
pagliarinilucas wants to merge 1 commit into
Conversation
A game switching into exclusive fullscreen (Elden Ring) dropped out of it again, in a loop, or stayed black after Alt+Tab: - while the game switches the display mode there is no foreground window for a moment; the bar took that as "fullscreen is over", came back on top and knocked the game out. The bar now returns only after 1.5 s without fullscreen. - place() and the slide animation re-inserted the bar at HWND_TOPMOST on every display change, i.e. above the game that had just become topmost. They keep the bar's z-order now (it is topmost from its creation); only a bar that comes back from hidden is raised. - a fullscreen game brought back with Alt+Tab has the foreground while still minimized: the window that was last seen fullscreen (and any D3D app Windows reports as fullscreen, SHQueryUserNotificationState) counts as fullscreen then. - switching to a minimized window (Alt+Tab, its button, a preview, the menu) restored it first and activated it after; the game got the foreground, lost it to the previous window and got it again, and gave up on fullscreen. Minimized windows now go through SwitchToThisWindow like Windows' own Alt+Tab. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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
I could not play Elden Ring in fullscreen with WinRust running. I used the floating dock and had Explorer replaced, and my monitor is 5120x1440.
topbar.execlosed and everything else of WinRust still running, the game started and stayed fullscreen. So the bar was knocking the game out of fullscreen.A WinEvent log (foreground, show/hide, location and z-order of the bar's and the game's windows) showed four separate causes.
Causes and fixes
All in
plugins/topbar/src/main.rs(plus one call site inthumbs.rs).GetForegroundWindow()is null for a moment.fs_updatetook that as "fullscreen is over", the bar slid back in on top, and the game lost fullscreen and tried again.→
fs_settled: the bar comes back only after fullscreen has been gone for 1.5 s without a break. The 250 ms poll keeps running while that wait is pending.place()(run onWM_DISPLAYCHANGE, which the game's mode switch causes) andbar_stepcalledSetWindowPos(HWND_TOPMOST)withoutSWP_NOZORDER. That moved the bar above the game, which had just become topmost.→ The bar keeps its z-order there. It is topmost from creation, and is raised again only when it comes back from hidden.
fullscreen_nowreturned false for any iconic window, so the bar stayed on top of it.→ The window last seen fullscreen still counts while it is minimized. So does anything Windows reports as
QUNS_RUNNING_D3D_FULL_SCREEN(SHQueryUserNotificationState).MINEND,MINSTARTand a foreground flip back within 0.3 s.→ A new
bring(w)used by Alt+Tab, the bar buttons, the previews and the app menu. For a minimized window it callsSwitchToThisWindow(w, TRUE), which is what Windows' own Alt+Tab uses. Otherwise, or if that fails, it falls back to the oldforce_fg+SW_RESTORE.Testing
cargo test -p topbar: 19 pass.cargo build --releaseis clean.Notes
alt_done, where both touch how the target window is activated. A rebase should be small whichever lands first.🤖 Generated with Claude Code