Skip to content

Commit 69c8ac0

Browse files
authored
Fix setResizable glitch on titleBarStyle="hidden"
1 parent 7df34c4 commit 69c8ac0

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

windows/window_manager.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,7 @@ void WindowManager::SetResizable(const flutter::EncodableMap &args)
450450
DWORD gwlStyle = GetWindowLong(hWnd, GWL_STYLE);
451451
gwlStyle = isResizable ? gwlStyle | WS_THICKFRAME : gwlStyle & ~WS_THICKFRAME;
452452
SetWindowLong(hWnd, GWL_STYLE, gwlStyle);
453+
SetWindowPos(hWnd, nullptr, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_DRAWFRAME);
453454
}
454455

455456
bool WindowManager::IsMinimizable()

windows/window_manager_plugin.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,15 @@ std::optional<LRESULT> WindowManagerPlugin::HandleWindowProc(HWND hWnd, UINT mes
105105
GetWindowPlacement(hWnd, &wPos);
106106
RECT borderThickness;
107107
SetRectEmpty(&borderThickness);
108-
AdjustWindowRectEx(&borderThickness, GetWindowLongPtr(hWnd, GWL_STYLE) & ~WS_CAPTION, FALSE, NULL);
108+
AdjustWindowRectEx(&borderThickness, GetWindowLongPtr(hWnd, GWL_STYLE) & ~WS_CAPTION & WS_BORDER, FALSE, NULL);
109109
NCCALCSIZE_PARAMS *sz = reinterpret_cast<NCCALCSIZE_PARAMS *>(lParam);
110+
111+
bool isResizable = window_manager->IsResizable();
110112
// Add 1 pixel to the top border to make the window resizable from the top border
111-
sz->rgrc[0].top += 1;
112-
sz->rgrc[0].right -= borderThickness.right;
113-
sz->rgrc[0].bottom -= borderThickness.bottom;
114-
sz->rgrc[0].left -= borderThickness.left;
113+
sz->rgrc[0].top += isResizable ? 1 : 0;
114+
sz->rgrc[0].right -= isResizable ? 7 : 0;
115+
sz->rgrc[0].bottom -= isResizable ? 7 : 0;
116+
sz->rgrc[0].left += isResizable ? 7 : 0;
115117

116118
return (WVR_HREDRAW | WVR_VREDRAW);
117119
}

0 commit comments

Comments
 (0)