X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fmain.c;h=a5e054f02d527d21020257f015eebea1b2b0b2a3;hb=8f69116a2c31b8aed0527e225c368b3466da6c8d;hp=eddf3fe3347b750844442d3e8ccbcb8a1065d4f8;hpb=547aa92b0d16ea0f5accb25ef8d72eaf95769c04;p=pspp diff --git a/src/ui/gui/main.c b/src/ui/gui/main.c index eddf3fe334..a5e054f02d 100644 --- a/src/ui/gui/main.c +++ b/src/ui/gui/main.c @@ -262,11 +262,12 @@ main (int argc, char *argv[]) g_warning ("%s", vers); } - /* Let GDK remove any options that it owns. */ - gdk_init (&argc, &argv); - /* Parse our own options. */ ss = create_source_stream (); + /* Parse our own options. + This must come BEFORE gdk_init otherwise options such as + --help --version which ought to work without an X server, won't. + */ parser = argv_parser_create (); argv_parser_add_options (parser, startup_options, N_STARTUP_OPTIONS, startup_option_callback, &show_splash); @@ -275,6 +276,11 @@ main (int argc, char *argv[]) exit (EXIT_FAILURE); argv_parser_destroy (parser); + /* Initialise GDK. Theoretically this call can remove options from argc,argv if + it thinks they are gdk options. + However there shouldn't be any here because of the gtk_parse_args call above. */ + gdk_init (&argc, &argv); + init_p.splash_window = create_splash_window (); init_p.ss = ss; init_p.data_file = optind < argc ? argv[optind] : NULL;