Repository navigation
fix(companion): stay on top after the foreground lock timeout - #5
Merged
Merged
Conversation
Windows refuses SetWindowPos(HWND_TOPMOST) from a background app once its start-up grace period (ForegroundLockTimeout, 200 s) ends, so after a few minutes the floating window opened behind the game again. The form is now created topmost, and a refused call is retried while attached to the foreground thread input (focus does not move). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
After the app had been running for a few minutes, a copied link opened the floating window behind WoW. Diagnostic log from the real game:
visible = True · topmost = False.Cause
Windows foreground lock: once the start-up grace period (
ForegroundLockTimeout= 200000 ms here) ends,SetWindowPos(HWND_TOPMOST)from a background process is refused while the game has the focus. Tests right after starting the app passed, which hid it.Fix
TopMostis set before the handle is created, so the window is born withWS_EX_TOPMOST.AttachThreadInputto the foreground thread (focus does not move); logged.Verified
Started the app, waited 215 s with WoW in the foreground, then copied a link:
topmost = True, z-order aboveWorld of Warcraft.🤖 Generated with Claude Code