fix(windows): sync Flutter render surface after SetBounds #582
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.
Call ForceChildRefresh() after SetWindowPos() in SetBounds() to ensure the Flutter render surface is properly synchronized with the new window size.
Problem:
When using setSize() or setBounds() to resize the window during app startup, Flutter's render surface may not sync correctly with the new window dimensions. This causes visual artifacts including:
Root cause:
SetWindowPos() triggers WM_SIZE which updates Flutter's logical coordinate system, but the physical render surface viewport may not update in time before the next frame is rendered.
Solution:
ForceChildRefresh() uses the +1px/-1px resize trick to force the Flutter view child window to fully synchronize its render surface. This is the same mechanism already used for WM_DPICHANGED and leave-full-screen scenarios.