Skip to content

Conversation

@kaes1a
Copy link

@kaes1a kaes1a commented Jan 21, 2026

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:

  • Black areas appearing at window edges
  • UI elements rendered at incorrect positions
  • Click events working correctly while visuals are misaligned

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.

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:
- Black areas appearing at window edges
- UI elements rendered at incorrect positions
- Click events working correctly while visuals are misaligned

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.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: kaes1a <leehncg@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant