diff options
Diffstat (limited to 'platform/macos/godot_window_delegate.mm')
-rw-r--r-- | platform/macos/godot_window_delegate.mm | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/platform/macos/godot_window_delegate.mm b/platform/macos/godot_window_delegate.mm index e1034c9993..94d40924b2 100644 --- a/platform/macos/godot_window_delegate.mm +++ b/platform/macos/godot_window_delegate.mm @@ -31,6 +31,7 @@ #include "godot_window_delegate.h" #include "display_server_macos.h" +#include "godot_button_view.h" @implementation GodotWindowDelegate @@ -76,10 +77,16 @@ DisplayServerMacOS::WindowData &wd = ds->get_window(window_id); wd.fullscreen = true; + // Reset window size limits. [wd.window_object setContentMinSize:NSMakeSize(0, 0)]; [wd.window_object setContentMaxSize:NSMakeSize(FLT_MAX, FLT_MAX)]; + // Reset custom window buttons. + if ([wd.window_object styleMask] & NSWindowStyleMaskFullSizeContentView) { + ds->window_set_custom_window_buttons(wd, false); + } + // Force window resize event. [self windowDidResize:notification]; } @@ -104,6 +111,11 @@ [wd.window_object setContentMaxSize:NSMakeSize(size.x, size.y)]; } + // Restore custom window buttons. + if ([wd.window_object styleMask] & NSWindowStyleMaskFullSizeContentView) { + ds->window_set_custom_window_buttons(wd, true); + } + // Restore resizability state. if (wd.resize_disabled) { [wd.window_object setStyleMask:[wd.window_object styleMask] & ~NSWindowStyleMaskResizable]; @@ -219,6 +231,10 @@ DisplayServerMacOS::WindowData &wd = ds->get_window(window_id); + if (wd.window_button_view) { + [(GodotButtonView *)wd.window_button_view displayButtons]; + } + if (ds->mouse_get_mode() == DisplayServer::MOUSE_MODE_CAPTURED) { const NSRect content_rect = [wd.window_view frame]; NSRect point_in_window_rect = NSMakeRect(content_rect.size.width / 2, content_rect.size.height / 2, 0, 0); @@ -241,6 +257,10 @@ DisplayServerMacOS::WindowData &wd = ds->get_window(window_id); + if (wd.window_button_view) { + [(GodotButtonView *)wd.window_button_view displayButtons]; + } + ds->release_pressed_events(); ds->send_window_event(wd, DisplayServerMacOS::WINDOW_EVENT_FOCUS_OUT); } |