From 208c2645daa5bec25acf1401382cac7655e21378 Mon Sep 17 00:00:00 2001 From: robxnano <89391914+robxnano@users.noreply.github.com> Date: Mon, 26 Aug 2024 23:31:25 +0100 Subject: [PATCH] GTK3: Fix --nogui option --- BasiliskII/src/Unix/main_unix.cpp | 25 +++++++++++++++---------- SheepShaver/src/Unix/main_unix.cpp | 21 +++++++++++++-------- 2 files changed, 28 insertions(+), 18 deletions(-) diff --git a/BasiliskII/src/Unix/main_unix.cpp b/BasiliskII/src/Unix/main_unix.cpp index 22e8c8ae..6c00a8df 100755 --- a/BasiliskII/src/Unix/main_unix.cpp +++ b/BasiliskII/src/Unix/main_unix.cpp @@ -430,7 +430,7 @@ static void gui_startup (void) #ifdef ENABLE_GTK_3_22 color_scheme_set(APP_PREFERS_LIGHT); #endif - if (!PrefsEditor()) + if (use_gui && !PrefsEditor()) QuitEmulator(); } @@ -514,22 +514,27 @@ int main(int argc, char **argv) printf("switch address not defined\n"); usage(argv[0]); } - // We intercept the --nogui commandline so that the settings - // window can change the setting from the prefs file + vde_sock = argv[i]; + argv[i] = NULL; } else if (strcmp(argv[i], "--nogui") == 0) { + // We intercept the --nogui commandline so that the settings + // window can change the setting from the prefs file argv[i++] = NULL; if (i < argc) { - if (strcmp(argv[i], "true") == 0) + if (strcmp(argv[i], "true") == 0) { use_gui = false; - else + argv[i] = NULL; + } + else if (strcmp(argv[i], "false") == 0) { use_gui = true; - argv[i] = NULL; + argv[i] = NULL; + } + } else { + use_gui = false; } - // Alternative commands to enter the GUI } else if (strcmp(argv[i], "--gui") == 0 || strcmp(argv[i], "--settings") == 0) { - use_gui = true; - argv[i] = NULL; - vde_sock = argv[i]; + // Alternative commands to enter the GUI + use_gui = true; argv[i] = NULL; } diff --git a/SheepShaver/src/Unix/main_unix.cpp b/SheepShaver/src/Unix/main_unix.cpp index 651dd931..deec68ff 100755 --- a/SheepShaver/src/Unix/main_unix.cpp +++ b/SheepShaver/src/Unix/main_unix.cpp @@ -862,21 +862,26 @@ int main(int argc, char **argv) UserPrefsPath = argv[i]; argv[i] = NULL; } - // We intercept the --nogui commandline so that the settings - // window can change the setting from the prefs file } else if (strcmp(argv[i], "--nogui") == 0) { + // We intercept the --nogui commandline so that the settings + // window can change the setting from the prefs file argv[i++] = NULL; if (i < argc) { - if (strcmp(argv[i], "true") == 0) + if (strcmp(argv[i], "true") == 0) { use_gui = false; - else + argv[i] = NULL; + } + else if (strcmp(argv[i], "false") == 0) { use_gui = true; - argv[i] = NULL; + argv[i] = NULL; + } + } else { + use_gui = false; } - // Alternative commands to enter the GUI } else if (strcmp(argv[i], "--gui") == 0 || strcmp(argv[i], "--settings") == 0) { - use_gui = true; - argv[i] = NULL; + // Alternative commands to enter the GUI + use_gui = true; + argv[i] = NULL; } else if (valid_vmdir(argv[i])) { vmdir = argv[i]; argv[i] = NULL;