From 426e5288a187a5d008a08ab7025d3e492addb89e Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Tue, 26 Sep 2023 11:55:25 +0300 Subject: [PATCH] [macOS] Fix borderless mode on macOS 13.6+. (cherry picked from commit 873d4079d16765abe6d07073daa779bd04eadb99) --- platform/macos/display_server_macos.mm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/platform/macos/display_server_macos.mm b/platform/macos/display_server_macos.mm index fcc2db7b05e..bf7799127b7 100644 --- a/platform/macos/display_server_macos.mm +++ b/platform/macos/display_server_macos.mm @@ -2954,7 +2954,9 @@ void DisplayServerMacOS::window_set_flag(WindowFlags p_flag, bool p_enabled, Win } break; case WINDOW_FLAG_BORDERLESS: { // OrderOut prevents a lose focus bug with the window. + bool was_visible = false; if ([wd.window_object isVisible]) { + was_visible = true; [wd.window_object orderOut:nil]; } wd.borderless = p_enabled; @@ -2969,7 +2971,7 @@ void DisplayServerMacOS::window_set_flag(WindowFlags p_flag, bool p_enabled, Win [wd.window_object setFrame:frameRect display:NO]; } _update_window_style(wd); - if ([wd.window_object isVisible]) { + if (was_visible || [wd.window_object isVisible]) { if ([wd.window_object isMiniaturized]) { return; } else if (wd.no_focus) {