Fix Windows fullscreen for multi-window Flutter views#483
Merged
boyan01 merged 1 commit intoJun 22, 2026
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR targets a Windows-only rendering issue in desktop_multi_window sub-windows where the hosted Flutter view can remain at its prior windowed size after fullscreen/style transitions (e.g., when driven by window_manager), sometimes leading to stale desktop content showing or freezes.
Changes:
- Introduces a deferred child-view resize mechanism by posting a coalesced “resize child content” message after window position changes.
- Refactors child Flutter view sizing into a dedicated
ResizeChildContent()helper (reused from multiple message paths). - Sets sub-window Flutter engines to
flutter::UIThreadPolicy::RunOnSeparateThreadto avoid fullscreen freezes during style changes.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/desktop_multi_window/windows/win32_window.h | Adds private helpers/flag to support coalesced deferred child-content resizing. |
| packages/desktop_multi_window/windows/win32_window.cpp | Implements deferred resize message + refactors child sizing into ResizeChildContent(); queues resize after DPI and window-position changes. |
| packages/desktop_multi_window/windows/flutter_window.cc | Sets Flutter engine UI thread policy to run on a separate thread for sub-windows. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
|
LGTM, thanks for the PR |
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
Fixes a Windows fullscreen rendering issue in
desktop_multi_windowsub-windows when another plugin, such aswindow_manager, changes the native window style and size for fullscreen.The observed failure was that the Flutter content stayed at its previous windowed size in the top-left corner after entering fullscreen, while the rest of the monitor could show stale/underlying desktop windows instead of the app background. In some fullscreen paths this could also hang or freeze the app.
Branch:
bugfix/windows-fullscreen-patchWhat Changed
flutter::UIThreadPolicy::RunOnSeparateThread.ResizeChildContent().WM_WINDOWPOSCHANGEDandWM_DPICHANGED, so the hosted Flutter child is re-sized to the updated client area after native fullscreen/window-position changes settle.PostMessagefails.Touched files:
packages/desktop_multi_window/windows/flutter_window.ccpackages/desktop_multi_window/windows/win32_window.cpppackages/desktop_multi_window/windows/win32_window.hWhy
desktop_multi_windowcreates each sub-window with its own native parent window and hosted Flutter child view. On Windows, entering fullscreen throughwindow_manager.setFullScreen()changes the top-level window style and position/size. The existingWM_SIZEpath resized the child in normal cases, but fullscreen style/position transitions could leave the child surface at the old windowed bounds for the frame that mattered, producing a top-left-only Flutter view.The deferred resize keeps the normal immediate
WM_SIZEhandling, while also scheduling a follow-up resize after native window-position changes. That avoids a force-refresh style workaround and makes the child view match the final fullscreen client area.The separate UI thread policy avoids recent Windows fullscreen freezes seen when fullscreen style changes are driven through platform-channel calls.
Validation
I've verified this patch in my flutter app and it works well.
Notes
This patch is intentionally Windows-only and scoped to the
desktop_multi_windownative sub-window wrapper. It does not change Dart APIs or behavior on macOS/Linux.