From bc2b2bd458e17e03762e8587cbfac2c6b0a8b750 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Fri, 2 Dec 2022 19:58:18 +0100 Subject: [PATCH] Factor in decorations when resizing macOS window Apparently macOS doesn't do this for you. If you don't do this then parts of the bottom and right of the window will be cut off. --- src/macos/window.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/macos/window.rs b/src/macos/window.rs index 8724dfa..259526c 100644 --- a/src/macos/window.rs +++ b/src/macos/window.rs @@ -336,7 +336,12 @@ impl Window { // If this is a standalone window then we'll also need to resize the window itself if let Some(ns_window) = self.ns_window { let mut frame = unsafe { NSWindow::frame(ns_window) }; + + // macOS wants you to manually add the size of the window decorations to the frame's + // size frame.size = size; + let frame = unsafe { NSWindow::frameRectForContentRect_(ns_window, frame) }; + unsafe { NSWindow::setFrame_display_(ns_window, frame, YES) } } }