From edb79a17886889e1482fbaf994bc28036c30f459 Mon Sep 17 00:00:00 2001 From: Cezary Kulakowski Date: Mon, 20 Sep 2021 11:25:10 +0200 Subject: [PATCH] fix: update Windows' cache after changing window's style To enable/disable window resizing we set/unset WS_THICKFRAME style flag on the window. Window's frame styles are cached so we need to call SetWindowPos with the SWP_FRAMECHANGED flag set to update cache properly. --- shell/browser/native_window_views.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/shell/browser/native_window_views.cc b/shell/browser/native_window_views.cc index b2ad39ca6c101..31e147204d128 100644 --- a/shell/browser/native_window_views.cc +++ b/shell/browser/native_window_views.cc @@ -111,6 +111,11 @@ void FlipWindowStyle(HWND handle, bool on, DWORD flag) { else style &= ~flag; ::SetWindowLong(handle, GWL_STYLE, style); + // Window's frame styles are cached so we need to call SetWindowPos + // with the SWP_FRAMECHANGED flag to update cache properly. + ::SetWindowPos(handle, 0, 0, 0, 0, 0, // ignored + SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | + SWP_NOACTIVATE | SWP_NOOWNERZORDER); } gfx::Rect DIPToScreenRect(HWND hwnd, const gfx::Rect& pixel_bounds) {