Skip to content

Commit 2ce213c

Browse files
author
axel10
committed
fix(windows): fix double titlebar on Windows 10 when TitleBarStyle is hidden
When `titleBarStyle` is set to `TitleBarStyle.hidden` on Windows 10, adding a 1px top offset in `WM_NCCALCSIZE` leaves a non-client margin at the top of the window. On Windows 10, DWM interprets this non-client margin as an active caption area and forces rendering of the system default title bar alongside the Flutter custom title bar. Removing the extra top offset allows the client area to cover the top edge completely, preventing DWM from drawing the native title bar.
1 parent dfd3467 commit 2ce213c

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

packages/window_manager/windows/window_manager_plugin.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,9 @@ std::optional<LRESULT> WindowManagerPlugin::HandleWindowProc(HWND hWnd,
168168
adjustNCCALCSIZE(hWnd, reinterpret_cast<NCCALCSIZE_PARAMS*>(lParam));
169169
} else {
170170
NCCALCSIZE_PARAMS* sz = reinterpret_cast<NCCALCSIZE_PARAMS*>(lParam);
171-
// on windows 10, if set to 0, there's a white line at the top
172-
// of the app and I've yet to find a way to remove that.
173-
sz->rgrc[0].top += IsWindows11OrGreater() ? 0 : 1;
171+
// Do not add top offset on Windows 10, otherwise DWM interprets the non-zero
172+
// non-client top margin as having a native caption and renders the system title bar.
173+
sz->rgrc[0].top += 0;
174174
// The following lines are required for resizing the window.
175175
// https://github.com/leanflutter/window_manager/issues/483
176176
sz->rgrc[0].right -= 8;

0 commit comments

Comments
 (0)