Repository navigation
topbar: fullscreen games keep fullscreen, also after Alt+Tab - #197
Closed
pagliarinilucas wants to merge 1 commit into
Closed
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 <noreply@anthropic.com>
Owner
|
Thank you! Merged into the It conflicted with a change that splits the fullscreen check per monitor (for the bar on secondary monitors), so I resolved that by hand: |
enthonyaraujo
added a commit
to enthonyaraujo/WinRust
that referenced
this pull request
Nov 27, 2026
Rebased on Lemxy#197, keeping only the cases still broken on top of it: - Defer place() while FULLSCREEN is active (on WM_DISPLAYCHANGE / ABN_POSCHANGED) and run it once fullscreen ends: a game running at a lower resolution than the desktop (e.g. stretched 1280x960 on 1920x1080) otherwise shrinks SPI_SETWORKAREA and trims maximized desktop windows via fit_maximized(), leaving them permanently shrunk after exiting the game. - Recognize any minimized fullscreen window on the primary monitor via GetWindowPlacement (in addition to FS_WND), so switching back still counts as fullscreen after another fullscreen window (e.g. F11 browser) overwrote FS_WND or after the bar restarted; also check QUNS_RUNNING_D3D_FULL_SCREEN before returning false on a transiently null foreground window. - Hide the bar immediately when entering fullscreen (and before activating a fullscreen target in bring()) instead of keeping the WS_EX_TOPMOST bar visible during a 240 ms slide-out, and skip raising HOST to HWND_TOPMOST while fullscreen. - In bring(), resolve GetLastActivePopup(w) and avoid injecting synthetic VK_MENU keys when SetForegroundWindow already succeeded; trigger app-button left clicks on WM_LBUTTONUP so the mouse button is not held down during AttachThreadInput / restore. - In Alt+Tab, start at index 0 when the desktop is focused instead of skipping the most recent window.
enthonyaraujo
added a commit
to enthonyaraujo/WinRust
that referenced
this pull request
Nov 27, 2026
…uperseded by rebase onto Lemxy#197)
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