1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

[macOS] Fix ~500ms hang on transparent OpenGL window creation on macOS 26.

This commit is contained in:
Pāvels Nadtočajevs
2025-10-14 23:51:41 +03:00
parent 0400b703e4
commit a63dd0704f

View File

@@ -2647,10 +2647,12 @@ void DisplayServerMacOS::window_set_flag(WindowFlags p_flag, bool p_enabled, Win
[wd.window_object setBackgroundColor:[NSColor colorWithCalibratedRed:0 green:0 blue:0 alpha:0.004f]]; [wd.window_object setBackgroundColor:[NSColor colorWithCalibratedRed:0 green:0 blue:0 alpha:0.004f]];
} }
// Force update of the window styles. // Force update of the window styles.
if ([wd.window_object isVisible]) {
NSRect frameRect = [wd.window_object frame]; NSRect frameRect = [wd.window_object frame];
[wd.window_object setFrame:NSMakeRect(frameRect.origin.x, frameRect.origin.y, frameRect.size.width + 1, frameRect.size.height) display:NO]; [wd.window_object setFrame:NSMakeRect(frameRect.origin.x, frameRect.origin.y, frameRect.size.width + 1, frameRect.size.height) display:NO];
[wd.window_object setFrame:frameRect display:NO]; [wd.window_object setFrame:frameRect display:NO];
} }
}
_update_window_style(wd, p_window); _update_window_style(wd, p_window);
if (was_visible || [wd.window_object isVisible]) { if (was_visible || [wd.window_object isVisible]) {
if ([wd.window_object isMiniaturized]) { if ([wd.window_object isMiniaturized]) {
@@ -2683,9 +2685,11 @@ void DisplayServerMacOS::window_set_flag(WindowFlags p_flag, bool p_enabled, Win
wd.layered_window = p_enabled; wd.layered_window = p_enabled;
set_window_per_pixel_transparency_enabled(p_enabled, p_window); set_window_per_pixel_transparency_enabled(p_enabled, p_window);
// Force update of the window styles. // Force update of the window styles.
if ([wd.window_object isVisible]) {
NSRect frameRect = [wd.window_object frame]; NSRect frameRect = [wd.window_object frame];
[wd.window_object setFrame:NSMakeRect(frameRect.origin.x, frameRect.origin.y, frameRect.size.width + 1, frameRect.size.height) display:NO]; [wd.window_object setFrame:NSMakeRect(frameRect.origin.x, frameRect.origin.y, frameRect.size.width + 1, frameRect.size.height) display:NO];
[wd.window_object setFrame:frameRect display:NO]; [wd.window_object setFrame:frameRect display:NO];
}
} break; } break;
case WINDOW_FLAG_NO_FOCUS: { case WINDOW_FLAG_NO_FOCUS: {
wd.no_focus = p_enabled; wd.no_focus = p_enabled;