Browse Source

[macOS] Refocus last key window after `DisplayServer::alert` is closed.

(cherry picked from commit a05776e20da8220ea7af364bbffbd43cd4605981)
bruvzg 5 years ago
parent
commit
a2f034d3ab
1 changed files with 4 additions and 0 deletions
  1. 4 0
      platform/osx/os_osx.mm

+ 4 - 0
platform/osx/os_osx.mm

@@ -1873,8 +1873,12 @@ void OS_OSX::alert(const String &p_alert, const String &p_title) {
 	[window setAlertStyle:NSAlertStyleWarning];
 	[window setAlertStyle:NSAlertStyleWarning];
 
 
 	// Display it, then release
 	// Display it, then release
+	id key_window = [[NSApplication sharedApplication] keyWindow];
 	[window runModal];
 	[window runModal];
 	[window release];
 	[window release];
+	if (key_window) {
+		[key_window makeKeyAndOrderFront:nil];
+	}
 }
 }
 
 
 Error OS_OSX::open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path) {
 Error OS_OSX::open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path) {