summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbruvzg <7645683+bruvzg@users.noreply.github.com>2023-09-21 12:37:18 +0300
committerbruvzg <7645683+bruvzg@users.noreply.github.com>2023-09-21 12:37:18 +0300
commit901e090e567bd425b84bf18fe773a3f0f641c42c (patch)
tree08d86ac2f8d93cbd76a3f3b261152abf27436edb
parent59139df16e7a10c3b9176f697d23b557af46601e (diff)
downloadredot-engine-901e090e567bd425b84bf18fe773a3f0f641c42c.tar.gz
[macOS] Enforce non-zero window size.
-rw-r--r--platform/macos/display_server_macos.mm4
1 files changed, 2 insertions, 2 deletions
diff --git a/platform/macos/display_server_macos.mm b/platform/macos/display_server_macos.mm
index bc78f343ee..2557145e0d 100644
--- a/platform/macos/display_server_macos.mm
+++ b/platform/macos/display_server_macos.mm
@@ -139,7 +139,7 @@ DisplayServerMacOS::WindowID DisplayServerMacOS::_create_window(WindowMode p_mod
// initWithContentRect uses bottom-left corner of the window’s frame as origin.
wd.window_object = [[GodotWindow alloc]
- initWithContentRect:NSMakeRect(100, 100, p_rect.size.width / scale, p_rect.size.height / scale)
+ initWithContentRect:NSMakeRect(100, 100, MAX(1, p_rect.size.width / scale), MAX(1, p_rect.size.height / scale))
styleMask:NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable | NSWindowStyleMaskResizable
backing:NSBackingStoreBuffered
defer:NO];
@@ -2912,7 +2912,7 @@ void DisplayServerMacOS::window_set_size(const Size2i p_size, WindowID p_window)
top_left.x = old_frame.origin.x;
top_left.y = NSMaxY(old_frame);
- NSRect new_frame = NSMakeRect(0, 0, size.x, size.y);
+ NSRect new_frame = NSMakeRect(0, 0, MAX(1, size.x), MAX(1, size.y));
new_frame = [wd.window_object frameRectForContentRect:new_frame];
new_frame.origin.x = top_left.x;