fix(windows): defer startup window restoration - #1080
Open
vicente-higino wants to merge 3 commits into
Open
Conversation
vicente-higino
marked this pull request as ready for review
August 10, 2026 00:30
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.
Summary
Follow-up to #1069 that focuses the window-related portion of the Windows startup issue.
Windows window-manager calls are now deferred until the native window and external placement tools have had 750 ms to settle. Stored bounds are restored only when the window still has the runner's native startup bounds and is neither maximized nor fullscreen.
The native runner changes are limited to keeping the hosted
FLUTTERVIEWvisible and ensuringWM_SIZEalways reaches the child-resize path.Relates to #1001.
Changes
WM_SIZEthrough the runner even when a plugin reports the message as handled.Impact
Normal saved window bounds still restore when no external manager changes startup placement. External placement is preserved instead of immediately being overwritten.
Some external managers use monitor-sized normal bounds instead of Windows' formal maximized state. This change intentionally preserves those external bounds rather than forcing a maximize command.
Validation
flutter test --no-pub test\window_helper_test.dart: 5/5 pass.flutter analyze --no-pub: no issues.AI Assistance Disclosure
This change was developed with assistance from OpenAI Codex. Codex was used to inspect the Dart and Win32 startup paths, correlate the behavior with #1001 and #1069, implement the automatic placement detection, add tests, build the Windows release, and run repeated HWND/
FLUTTERVIEWprobes.Approximately three hours of active AI-assisted investigation, implementation, and validation went into the window portion, plus several days of intermittent manual testing by the contributor. The extended investigation was needed because a responsive top-level HWND could still contain an invisible Flutter child, and external window placement raced with both first-frame attachment and saved-bounds restoration.