From 425ee7ac3532c2800322244c423584e5a9172790 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Sun, 1 Jan 2023 23:43:04 +0100 Subject: [PATCH] Add missing AdjustWindowRectEx() for resize --- src/win/window.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/win/window.rs b/src/win/window.rs index 4689515..83ff6d2 100644 --- a/src/win/window.rs +++ b/src/win/window.rs @@ -489,14 +489,23 @@ impl WindowState { *window_info }; + // If the window is a standalone window then the size needs to include the window + // decorations + let mut rect = RECT { + left: 0, + top: 0, + right: window_info.physical_size().width as i32, + bottom: window_info.physical_size().height as i32, + }; unsafe { + AdjustWindowRectEx(&mut rect, self.dw_style, 0, 0); SetWindowPos( self.hwnd, self.hwnd, 0, 0, - window_info.physical_size().width as i32, - window_info.physical_size().height as i32, + rect.right - rect.left, + rect.bottom - rect.top, SWP_NOZORDER | SWP_NOMOVE, ) };