Skip to content

Restore Windows frame before geometry changes and preserve DWM frame on normal shadowless windows - #109

Merged
lijy91 merged 1 commit into
mainfrom
fix/windows-geometry-and-shadow
Dec 1, 2026
Merged

lijy91 merged 1 commit into
mainfrom
fix/windows-geometry-and-shadow

Conversation

@lijy91

@lijy91 lijy91 commented Dec 1, 2026

Copy link
Copy Markdown
Member

Summary

Fixes two Windows windowing frame regressions observed in window_example and custom-title-bar windows:

  1. Corrupted window border when calling geometry setters (SetSize, SetContentSize, SetBounds, SetContentBounds, SetPosition) while FullScreen or Maximized:

    • In fullscreen (g_full_screen_windows), SetWindowPos previously resized the frame-stripped (~(WS_CAPTION | WS_THICKFRAME)) window directly while keeping IsFullScreen() == true, leaving a borderless/shadowless window at (0, 0) until manually dragged or toggled.
    • In maximized (IsZoomed), SetWindowPos shrank the window while leaving WS_MAXIMIZE set and keeping the off-screen maximized border origin (-padded_border, -padded_border) until dragging triggered Aero tear-off (SC_RESTORE).
    • Added RestoreWindowForGeometryChange (sharing ExitFullScreen) so explicit geometry setters cleanly exit fullscreen and unmaximize to a normal framed placement before applying the requested size/bounds/position, then synchronize the client area once at the final size.
  2. System-decorated (TitleBarStyle::Normal) windows degrading to classic Windows 7 / Aero Basic border when SetHasShadow(false) is called:

    • UpdateFrameRendering previously set DWMNCRP_DISABLED whenever kNoShadowProperty was present even on TitleBarStyle::Normal windows, disabling DWM non-client rendering and forcing classic theme borders/captions.
    • Keep compositor = true (DWMNCRP_USEWINDOWSTYLE) whenever !hidden (TitleBarStyle::Normal) while still recording kNoShadowProperty (HasShadow() == false), so switching to TitleBarStyle::Hidden applies the shadowless frameless policy without breaking system-decorated windows.

Verification

  • Added window_geometry_and_shadow_windows_test covering SetHasShadow(false) across Normal <-> Hidden transitions and SetSize / SetContentSize / SetPosition from FullScreen, Maximize -> FullScreen, Maximized, and pre-show Maximize().
  • Verified all Windows window_* CTest targets pass and rebuilt examples/flutter_window_example.

@lijy91
lijy91 force-pushed the fix/windows-geometry-and-shadow branch from 32d4f7c to 8d4a4f2 Compare December 1, 2026 00:59
@lijy91
lijy91 merged commit bc73bec into main Dec 1, 2026
11 checks passed
@lijy91
lijy91 deleted the fix/windows-geometry-and-shadow branch December 1, 2026 02:55
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