1
0
Fork 0

Set macOS window size using setContentSize

I somehow completely missed this the first five times I looked through
the docs.
This commit is contained in:
Robbert van der Helm 2022-12-16 23:20:56 +01:00
parent d7a8c52d23
commit 512c3f2393

View file

@ -337,14 +337,7 @@ impl Window {
// If this is a standalone window then we'll also need to resize the window itself // If this is a standalone window then we'll also need to resize the window itself
if let Some(ns_window) = self.ns_window { if let Some(ns_window) = self.ns_window {
let mut frame = unsafe { NSWindow::frame(ns_window) }; unsafe { NSWindow::setContentSize_(ns_window, size) };
// 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) }
} }
} }