On Windows, fix window shrinking when leaving fullscreen in some situations (#718)

* Fix resize border appearing in some cases after leaving fullscreen.

* On fullscreen, save client rect instead of window rect

* Add CHANGELOG entry

* Revert test changes to fullscreen example

* Update panic message when unable to get client area
This commit is contained in:
Osspial 2018-11-20 15:57:06 -05:00 committed by Francesca Plebani
parent 92873b06ed
commit aabf0e13b7
4 changed files with 33 additions and 46 deletions

View file

@ -55,6 +55,19 @@ pub fn get_window_rect(hwnd: HWND) -> Option<RECT> {
unsafe { status_map(|rect| winuser::GetWindowRect(hwnd, rect)) }
}
pub fn get_client_rect(hwnd: HWND) -> Option<RECT> {
unsafe { status_map(|rect| {
let mut top_left = mem::zeroed();
if 0 == winuser::ClientToScreen(hwnd, &mut top_left) {return 0;};
if 0 == winuser::GetClientRect(hwnd, rect) {return 0};
rect.left += top_left.x;
rect.top += top_left.y;
rect.right += top_left.x;
rect.bottom += top_left.y;
1
}) }
}
// This won't be needed anymore if we just add a derive to winapi.
pub fn rect_eq(a: &RECT, b: &RECT) -> bool {
let left_eq = a.left == b.left;