fix: update Windows' cache after changing window's style (#31021)

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.
This commit is contained in:
CezaryKulakowski 2021-09-23 09:33:41 +02:00 committed by GitHub
parent bb6dc99d9d
commit 68d3659f75
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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) {