Repository navigation
Show maximized auxiliary windows after restore - #351274
Open
Adi1231234 wants to merge 1 commit into
Open
Adi1231234 wants to merge 1 commit into
Adi1231234 wants to merge 1 commit into
Conversation
The state of an auxiliary window was applied from the constructor, before the BrowserWindow could be claimed, so maximize() and show() had no window to act on and the state was never applied again. A window restored as maximized is created hidden and stayed hidden. Fixes microsoft#330650
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the change that defers saved-state application until the auxiliary window is available.
No open issues 🎉
What changed in this PR
Fixes hidden maximized auxiliary windows on restart by waiting until the Electron window has been claimed before applying its saved state.
Changes:
- Requires
_winto exist before applying state, preserving the later opportunity to maximize and show the window. - Adds a comment explaining why applying state too early leaves hidden windows invisible.
| File | Description |
|---|---|
src/vs/platform/auxiliaryWindow/electron-main/auxiliaryWindow.ts |
Defers saved-state application until the auxiliary window is available. |
Review effort: Balanced
This branch has not been deployed
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.
Fixes #330650
If an auxiliary window is maximized when VS Code closes, it comes back hidden on the next start.
AuxiliaryWindowcallstryClaimWindow()from its constructor, which runs onweb-contents-created. At that pointBrowserWindow.fromWebContents()still returns nothing, so_winis undefined. Since d1e225f that call falls back tothis.windowOptionsand runsapplyState()right away.maximize()andshow()do nothing without a window, butstateAppliedis already true, so when the window is claimed onbrowser-window-createdthe state is not applied again. A window restored as maximized is created withshow: false, so nothing ever shows it.That also explains the alternating pattern people describe in the issue: after a failed restore the window is saved as not maximized, so the next start works.
If you then open an editor that lives in that window,
moveWindowTop()callsmoveTop()on it. That makes the window visible to the OS without Chromium showing it, so it never paints and you get an empty window in the background color.The fix only applies the state once the window has been claimed.
Tested on 1.147.0 on Windows by applying the same change to the built main bundle:
moveTop()it stayed unpainted