mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2025-01-11 21:31:29 +11:00
Fix building on Windows 7 and 8 (#1398)
* Fix building on Windows 7 and 8 * Format
This commit is contained in:
parent
3e3bb8a8f1
commit
0ae78db6cb
|
@ -1470,7 +1470,6 @@ unsafe extern "system" fn public_window_callback<T: 'static>(
|
||||||
|
|
||||||
let style = winuser::GetWindowLongW(window, winuser::GWL_STYLE) as _;
|
let style = winuser::GetWindowLongW(window, winuser::GWL_STYLE) as _;
|
||||||
let style_ex = winuser::GetWindowLongW(window, winuser::GWL_EXSTYLE) as _;
|
let style_ex = winuser::GetWindowLongW(window, winuser::GWL_EXSTYLE) as _;
|
||||||
let b_menu = !winuser::GetMenu(window).is_null() as BOOL;
|
|
||||||
|
|
||||||
// New size as suggested by Windows.
|
// New size as suggested by Windows.
|
||||||
let suggested_rect = *(lparam as *const RECT);
|
let suggested_rect = *(lparam as *const RECT);
|
||||||
|
@ -1484,14 +1483,9 @@ unsafe extern "system" fn public_window_callback<T: 'static>(
|
||||||
// let margin_right: i32;
|
// let margin_right: i32;
|
||||||
// let margin_bottom: i32;
|
// let margin_bottom: i32;
|
||||||
{
|
{
|
||||||
let mut adjusted_rect = suggested_rect;
|
let adjusted_rect =
|
||||||
winuser::AdjustWindowRectExForDpi(
|
util::adjust_window_rect_with_styles(window, style, style_ex, suggested_rect)
|
||||||
&mut adjusted_rect,
|
.unwrap_or(suggested_rect);
|
||||||
style,
|
|
||||||
b_menu,
|
|
||||||
style_ex,
|
|
||||||
new_dpi_x,
|
|
||||||
);
|
|
||||||
margin_left = suggested_rect.left - adjusted_rect.left;
|
margin_left = suggested_rect.left - adjusted_rect.left;
|
||||||
margin_top = suggested_rect.top - adjusted_rect.top;
|
margin_top = suggested_rect.top - adjusted_rect.top;
|
||||||
// margin_right = adjusted_rect.right - suggested_rect.right;
|
// margin_right = adjusted_rect.right - suggested_rect.right;
|
||||||
|
@ -1556,13 +1550,13 @@ unsafe extern "system" fn public_window_callback<T: 'static>(
|
||||||
bottom: suggested_ul.1 + new_physical_inner_size.height as LONG,
|
bottom: suggested_ul.1 + new_physical_inner_size.height as LONG,
|
||||||
};
|
};
|
||||||
|
|
||||||
winuser::AdjustWindowRectExForDpi(
|
conservative_rect = util::adjust_window_rect_with_styles(
|
||||||
&mut conservative_rect,
|
window,
|
||||||
style,
|
style,
|
||||||
b_menu,
|
|
||||||
style_ex,
|
style_ex,
|
||||||
new_dpi_x,
|
conservative_rect,
|
||||||
);
|
)
|
||||||
|
.unwrap_or(conservative_rect);
|
||||||
|
|
||||||
// If we're not dragging the window, offset the window so that the cursor's
|
// If we're not dragging the window, offset the window so that the cursor's
|
||||||
// relative horizontal position in the title bar is preserved.
|
// relative horizontal position in the title bar is preserved.
|
||||||
|
|
Loading…
Reference in a new issue