1
0
Fork 0

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.
This commit is contained in:
Robbert van der Helm 2022-12-02 19:58:18 +01:00
parent c7b61fa39b
commit bc2b2bd458

View file

@ -336,7 +336,12 @@ 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) }; 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; frame.size = size;
let frame = unsafe { NSWindow::frameRectForContentRect_(ns_window, frame) };
unsafe { NSWindow::setFrame_display_(ns_window, frame, YES) } unsafe { NSWindow::setFrame_display_(ns_window, frame, YES) }
} }
} }