From da7bf8e29bcb786ad713ff67ba89d89c9152ee44 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Thu, 8 Sep 2022 18:54:22 +0200 Subject: [PATCH] macOS: Fix WindowBuilder::with_resize_increments (#2477) Introduced in https://github.com/rust-windowing/winit/pull/2411 --- src/platform_impl/macos/window.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/platform_impl/macos/window.rs b/src/platform_impl/macos/window.rs index 43cbabf8..4bc29025 100644 --- a/src/platform_impl/macos/window.rs +++ b/src/platform_impl/macos/window.rs @@ -77,7 +77,6 @@ pub struct PlatformSpecificWindowBuilderAttributes { pub titlebar_hidden: bool, pub titlebar_buttons_hidden: bool, pub fullsize_content_view: bool, - pub resize_increments: Option>, pub disallow_hidpi: bool, pub has_shadow: bool, } @@ -92,7 +91,6 @@ impl Default for PlatformSpecificWindowBuilderAttributes { titlebar_hidden: false, titlebar_buttons_hidden: false, fullsize_content_view: false, - resize_increments: None, disallow_hidpi: false, has_shadow: true, } @@ -331,10 +329,11 @@ impl WinitWindow { this.setLevel(NSWindowLevel::Floating); } - if let Some(increments) = pl_attrs.resize_increments { + if let Some(increments) = attrs.resize_increments { + let increments = increments.to_logical(this.scale_factor()); let (w, h) = (increments.width, increments.height); if w >= 1.0 && h >= 1.0 { - let size = NSSize::new(w as CGFloat, h as CGFloat); + let size = NSSize::new(w, h); // It was concluded (#2411) that there is never a use-case for // "outer" resize increments, hence we set "inner" ones here. // ("outer" in macOS being just resizeIncrements, and "inner" - contentResizeIncrements)