Fix Windows fullscreen for multi-window Flutter views#483
Open
caoccao wants to merge 1 commit into
Open
Conversation
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.