mirror of
https://github.com/godotengine/godot.git
synced 2024-11-27 09:16:35 +08:00
[macOS] Enforce non-zero window size.
This commit is contained in:
parent
59139df16e
commit
901e090e56
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user