Fix size calculation of non-decorated windows (#245) (#246)

This commit is contained in:
swismer 2021-04-03 08:08:51 +02:00 committed by GitHub
parent 0df7c35058
commit 75a25ce898
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -497,25 +497,6 @@ impl Window {
}
}
let new_width = width * scale_factor as usize;
let new_height = height * scale_factor as usize;
let mut rect = windef::RECT {
left: 0,
right: new_width as ntdef::LONG,
top: 0,
bottom: new_height as ntdef::LONG,
};
winuser::AdjustWindowRect(
&mut rect,
winuser::WS_POPUP | winuser::WS_SYSMENU | winuser::WS_CAPTION,
0,
);
rect.right -= rect.left;
rect.bottom -= rect.top;
let window_name = to_wstring(name);
let mut flags = 0;
@ -545,6 +526,21 @@ impl Window {
flags = winuser::WS_VISIBLE | winuser::WS_POPUP;
}
let new_width = width * scale_factor as usize;
let new_height = height * scale_factor as usize;
let mut rect = windef::RECT {
left: 0,
right: new_width as ntdef::LONG,
top: 0,
bottom: new_height as ntdef::LONG,
};
winuser::AdjustWindowRect(&mut rect, flags, 0);
rect.right -= rect.left;
rect.bottom -= rect.top;
let handle = winuser::CreateWindowExW(
0,
class_name.as_ptr(),