mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 07:53:26 +00:00
[macOS] Always use "Regular" activation policy for GUI, and headless main loop for command line only tools.
This commit is contained in:
parent
28bd72a7e1
commit
6e76a9467f
3 changed files with 22 additions and 4 deletions
|
@ -1860,7 +1860,6 @@ void DisplayServerMacOS::show_window(WindowID p_id) {
|
|||
WindowData &wd = windows[p_id];
|
||||
|
||||
if (p_id == MAIN_WINDOW_ID) {
|
||||
[GodotApp setActivationPolicy:NSApplicationActivationPolicyRegular];
|
||||
[GodotApp activateApplication];
|
||||
}
|
||||
|
||||
|
|
|
@ -58,6 +58,21 @@ int main(int argc, char **argv) {
|
|||
bool is_embedded = false;
|
||||
bool is_headless = false;
|
||||
|
||||
const char *headless_args[] = {
|
||||
"--headless",
|
||||
"-h",
|
||||
"--help",
|
||||
"/?",
|
||||
"--version",
|
||||
"--dump-gdextension-interface",
|
||||
"--dump-extension-api",
|
||||
"--dump-extension-api-with-docs",
|
||||
"--validate-extension-api",
|
||||
"--convert-3to4",
|
||||
"--validate-conversion-3to4",
|
||||
"--doctool",
|
||||
};
|
||||
|
||||
for (int i = 0; i < argc; i++) {
|
||||
if (strcmp("-NSDocumentRevisionsDebugMode", argv[i]) == 0) {
|
||||
// remove "-NSDocumentRevisionsDebugMode" and the next argument
|
||||
|
@ -76,9 +91,13 @@ int main(int argc, char **argv) {
|
|||
if (strcmp("--embedded", argv[i]) == 0) {
|
||||
is_embedded = true;
|
||||
}
|
||||
if (strcmp("--headless", argv[i]) == 0 || strcmp("--doctool", argv[i]) == 0) {
|
||||
is_headless = true;
|
||||
for (size_t j = 0; j < std::size(headless_args); j++) {
|
||||
if (strcmp(headless_args[j], argv[i]) == 0) {
|
||||
is_headless = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i < argc - 1 && strcmp("--display-driver", argv[i]) == 0 && strcmp("headless", argv[i + 1]) == 0) {
|
||||
is_headless = true;
|
||||
}
|
||||
|
|
|
@ -1153,7 +1153,7 @@ OS_MacOS_NSApp::OS_MacOS_NSApp(const char *p_execpath, int p_argc, char **p_argv
|
|||
[GodotApplication sharedApplication];
|
||||
|
||||
// In case we are unbundled, make us a proper UI application.
|
||||
[NSApp setActivationPolicy:NSApplicationActivationPolicyAccessory];
|
||||
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
|
||||
|
||||
// Menu bar setup must go between sharedApplication above and
|
||||
// finishLaunching below, in order to properly emulate the behavior
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue