X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b045eff2153b4ac8ca84da96728b52edaf660397..03a126c68c940c13a7a6c9ee183fa88e9b575a21:/src/gtk/app.cpp?ds=sidebyside diff --git a/src/gtk/app.cpp b/src/gtk/app.cpp index ff408b679d..33cf2dc6a0 100644 --- a/src/gtk/app.cpp +++ b/src/gtk/app.cpp @@ -266,10 +266,6 @@ GtkWidget* wxGetRootWindow() IMPLEMENT_DYNAMIC_CLASS(wxApp,wxEvtHandler) -BEGIN_EVENT_TABLE(wxApp, wxEvtHandler) - EVT_IDLE(wxAppBase::OnIdle) -END_EVENT_TABLE() - wxApp::wxApp() { #ifdef __WXDEBUG__ @@ -346,9 +342,10 @@ GdkVisual *wxApp::GetGdkVisual() return visual; } -bool wxApp::Initialize(int& argc, wxChar **argv) +// use unusual names for the parameters to avoid conflict with wxApp::arg[cv] +bool wxApp::Initialize(int& argc_, wxChar **argv_) { - if ( !wxAppBase::Initialize(argc, argv) ) + if ( !wxAppBase::Initialize(argc_, argv_) ) return false; #if wxUSE_THREADS @@ -407,15 +404,15 @@ bool wxApp::Initialize(int& argc, wxChar **argv) #if wxUSE_UNICODE // gtk_init() wants UTF-8, not wchar_t, so convert int i; - char **argvGTK = new char *[argc + 1]; - for ( i = 0; i < argc; i++ ) + char **argvGTK = new char *[argc_ + 1]; + for ( i = 0; i < argc_; i++ ) { - argvGTK[i] = wxStrdupA(wxConvUTF8.cWX2MB(argv[i])); + argvGTK[i] = wxStrdupA(wxConvUTF8.cWX2MB(argv_[i])); } - argvGTK[argc] = NULL; + argvGTK[argc_] = NULL; - int argcGTK = argc; + int argcGTK = argc_; #ifdef __WXGPE__ init_result = true; // is there a _check() version of this? @@ -423,19 +420,20 @@ bool wxApp::Initialize(int& argc, wxChar **argv) #else init_result = gtk_init_check( &argcGTK, &argvGTK ); #endif + wxUpdateLocaleIsUtf8(); - if ( argcGTK != argc ) + if ( argcGTK != argc_ ) { // we have to drop the parameters which were consumed by GTK+ for ( i = 0; i < argcGTK; i++ ) { - while ( strcmp(wxConvUTF8.cWX2MB(argv[i]), argvGTK[i]) != 0 ) + while ( strcmp(wxConvUTF8.cWX2MB(argv_[i]), argvGTK[i]) != 0 ) { - memmove(argv + i, argv + i + 1, (argc - i)*sizeof(*argv)); + memmove(argv_ + i, argv_ + i + 1, (argc_ - i)*sizeof(*argv_)); } } - argc = argcGTK; + argc_ = argcGTK; } //else: gtk_init() didn't modify our parameters @@ -447,14 +445,14 @@ bool wxApp::Initialize(int& argc, wxChar **argv) delete [] argvGTK; #else // !wxUSE_UNICODE - // gtk_init() shouldn't actually change argv itself (just its contents) so + // gtk_init() shouldn't actually change argv_ itself (just its contents) so // it's ok to pass pointer to it - init_result = gtk_init_check( &argc, &argv ); + init_result = gtk_init_check( &argc_, &argv_ ); #endif // wxUSE_UNICODE/!wxUSE_UNICODE // update internal arg[cv] as GTK+ may have removed processed options: - this->argc = argc; - this->argv = argv; + this->argc = argc_; + this->argv = argv_; if ( m_traits ) { @@ -465,10 +463,10 @@ bool wxApp::Initialize(int& argc, wxChar **argv) wxArrayString opt, desc; m_traits->GetStandardCmdLineOptions(opt, desc); - for ( int i = 0; i < argc; i++ ) + for ( int i = 0; i < argc_; i++ ) { // leave just the names of the options with values - const wxString str(wxString(argv[i]).BeforeFirst('=')); + const wxString str = wxString(argv_[i]).BeforeFirst('='); for ( size_t j = 0; j < opt.size(); j++ ) { @@ -481,7 +479,7 @@ bool wxApp::Initialize(int& argc, wxChar **argv) // 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]); + argv_[0]); return false; } }