Merge pull request #40732 from bruvzg/macos_refocus_after_alert

[macOS] Refocus last key window after `DisplayServer::alert` is closed.
This commit is contained in:
Rémi Verschelde 2020-07-26 22:45:09 +02:00 committed by GitHub
commit 8636be35b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1944,8 +1944,12 @@ void DisplayServerOSX::alert(const String &p_alert, const String &p_title) {
[window setInformativeText:ns_alert]; [window setInformativeText:ns_alert];
[window setAlertStyle:NSAlertStyleWarning]; [window setAlertStyle:NSAlertStyleWarning];
id key_window = [[NSApplication sharedApplication] keyWindow];
[window runModal]; [window runModal];
[window release]; [window release];
if (key_window) {
[key_window makeKeyAndOrderFront:nil];
}
} }
Error DisplayServerOSX::dialog_show(String p_title, String p_description, Vector<String> p_buttons, const Callable &p_callback) { Error DisplayServerOSX::dialog_show(String p_title, String p_description, Vector<String> p_buttons, const Callable &p_callback) {