X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a1abca322fd7a9a7abe6cc0b144987786faa0f05..10816efb2cb6561a227a87de6d5f8b5750c2705d:/src/gtk/app.cpp diff --git a/src/gtk/app.cpp b/src/gtk/app.cpp index 56b33401b8..14b556b2e5 100644 --- a/src/gtk/app.cpp +++ b/src/gtk/app.cpp @@ -34,6 +34,7 @@ #include "wx/gtk/win_gtk.h" #include "wx/gtk/private.h" +#include "wx/apptrait.h" #include @@ -422,6 +423,7 @@ bool wxApp::Initialize(int& argc, wxChar **argv) #else init_result = gtk_init_check( &argcGTK, &argvGTK ); #endif + wxUpdateLocaleIsUtf8(); if ( argcGTK != argc ) { @@ -451,8 +453,45 @@ bool wxApp::Initialize(int& argc, wxChar **argv) init_result = gtk_init_check( &argc, &argv ); #endif // wxUSE_UNICODE/!wxUSE_UNICODE - if (!init_result) { - wxLogError(wxT("Unable to initialize gtk, is DISPLAY set properly?")); + // update internal arg[cv] as GTK+ may have removed processed options: + this->argc = argc; + this->argv = argv; + + if ( m_traits ) + { + // if there are still GTK+ standard options unparsed in the command + // line, it means that they were not syntactically correct and GTK+ + // already printed a warning on the command line and we should now + // exit: + wxArrayString opt, desc; + m_traits->GetStandardCmdLineOptions(opt, desc); + + for ( int i = 0; i < argc; i++ ) + { + // leave just the names of the options with values + const wxString str = wxString(argv[i]).BeforeFirst('='); + + for ( size_t j = 0; j < opt.size(); j++ ) + { + // remove the leading spaces from the option string as it does + // have them + if ( opt[j].Trim(false).BeforeFirst('=') == str ) + { + // a GTK+ option can be left on the command line only if + // there was an error in (or before, in another standard + // options) it, so abort, just as we do if incorrect + // program option is given + wxLogError(_("Invalid GTK+ command line option, use \"%s --help\""), + argv[0]); + return false; + } + } + } + } + + if ( !init_result ) + { + wxLogError(_("Unable to initialize GTK+, is DISPLAY set properly?")); return false; }