From abca8ebff16ef0e95292a5ceb1aa9fc302552c5d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 30 Jun 2003 20:33:30 +0000 Subject: [PATCH] small wxGTK compilation fixes git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21523 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/app.h | 12 +++--------- include/wx/gtk/app.h | 2 -- include/wx/gtk1/app.h | 2 -- src/common/init.cpp | 6 ++++-- src/gtk/app.cpp | 16 ++++++++++------ src/gtk1/app.cpp | 16 ++++++++++------ 6 files changed, 27 insertions(+), 27 deletions(-) diff --git a/include/wx/app.h b/include/wx/app.h index 22afb2459b..7d27f9a427 100644 --- a/include/wx/app.h +++ b/include/wx/app.h @@ -24,7 +24,6 @@ #endif // wxUSE_GUI #include "wx/build.h" -#include "wx/init.h" class WXDLLEXPORT wxApp; class WXDLLEXPORT wxAppTraits; @@ -553,14 +552,9 @@ public: // be in your main program (e.g. hello.cpp). Now IMPLEMENT_APP should add this // code if required. -#if !wxUSE_GUI || defined(__WXMOTIF__) || defined(__WXGTK__) || defined(__WXPM__) || defined(__WXMGL__) || defined(__WXCOCOA__) - #define IMPLEMENT_WXWIN_MAIN \ - extern int wxEntry( int argc, char **argv ); \ - int main(int argc, char **argv) { return wxEntry(argc, argv); } -#elif defined(__WXMAC__) - // wxMac seems to have a specific wxEntry prototype - #define IMPLEMENT_WXWIN_MAIN \ - extern int wxEntry( int argc, char **argv, bool enterLoop = TRUE ); \ +#if !wxUSE_GUI || !defined(__WXMSW__) + #define IMPLEMENT_WXWIN_MAIN \ + extern int wxEntry( int& argc, char **argv ); \ int main(int argc, char **argv) { return wxEntry(argc, argv); } #elif defined(__WXMSW__) && defined(WXUSINGDLL) #define IMPLEMENT_WXWIN_MAIN \ diff --git a/include/wx/gtk/app.h b/include/wx/gtk/app.h index 1cda1b39ea..f03e5aa1ff 100644 --- a/include/wx/gtk/app.h +++ b/include/wx/gtk/app.h @@ -96,6 +96,4 @@ private: DECLARE_EVENT_TABLE() }; -int WXDLLEXPORT wxEntry( int argc, char *argv[] ); - #endif // __GTKAPPH__ diff --git a/include/wx/gtk1/app.h b/include/wx/gtk1/app.h index 1cda1b39ea..f03e5aa1ff 100644 --- a/include/wx/gtk1/app.h +++ b/include/wx/gtk1/app.h @@ -96,6 +96,4 @@ private: DECLARE_EVENT_TABLE() }; -int WXDLLEXPORT wxEntry( int argc, char *argv[] ); - #endif // __GTKAPPH__ diff --git a/src/common/init.cpp b/src/common/init.cpp index ec81ea6ede..69dadc09e0 100644 --- a/src/common/init.cpp +++ b/src/common/init.cpp @@ -31,6 +31,8 @@ #include "wx/thread.h" #endif +#include "wx/init.h" + #include "wx/ptr_scpd.h" #include "wx/module.h" @@ -409,7 +411,7 @@ int wxEntryReal(int& argc, wxChar **argv) extern unsigned long wxGlobalSEHandler(); -int wxEntry(int argc, wxChar **argv) +int wxEntry(int& argc, wxChar **argv) { __try { @@ -429,7 +431,7 @@ int wxEntry(int argc, wxChar **argv) #if wxUSE_UNICODE // as with wxEntryStart, we provide an ANSI wrapper -int wxEntry(int argc, char **argv) +int wxEntry(int& argc, char **argv) { ConvertArgsToUnicode(argc, argv); diff --git a/src/gtk/app.cpp b/src/gtk/app.cpp index 66f2b9a395..b7ce136139 100644 --- a/src/gtk/app.cpp +++ b/src/gtk/app.cpp @@ -671,11 +671,8 @@ void wxApp::Dispatch() gtk_main_iteration(); } -bool wxApp::Initialize(int argc, wxChar **argv) +bool wxApp::Initialize(int& argc, wxChar **argv) { - if ( !wxAppBase::Initialize(argc, argv) ) - return false; - #if wxUSE_THREADS // GTK 1.2 up to version 1.2.3 has broken threads if ((gtk_major_version == 1) && @@ -751,6 +748,13 @@ bool wxApp::Initialize(int argc, wxChar **argv) // we can not enter threads before gtk_init is done gdk_threads_enter(); + if ( !wxAppBase::Initialize(argc, argv) ) + { + gdk_threads_leave(); + + return false; + } + wxSetDetectableAutoRepeat( TRUE ); #if wxUSE_INTL @@ -764,9 +768,9 @@ bool wxApp::Initialize(int argc, wxChar **argv) void wxApp::CleanUp() { - wxAppBase::CleanUp(); - gdk_threads_leave(); + + wxAppBase::CleanUp(); } #ifdef __WXDEBUG__ diff --git a/src/gtk1/app.cpp b/src/gtk1/app.cpp index 66f2b9a395..b7ce136139 100644 --- a/src/gtk1/app.cpp +++ b/src/gtk1/app.cpp @@ -671,11 +671,8 @@ void wxApp::Dispatch() gtk_main_iteration(); } -bool wxApp::Initialize(int argc, wxChar **argv) +bool wxApp::Initialize(int& argc, wxChar **argv) { - if ( !wxAppBase::Initialize(argc, argv) ) - return false; - #if wxUSE_THREADS // GTK 1.2 up to version 1.2.3 has broken threads if ((gtk_major_version == 1) && @@ -751,6 +748,13 @@ bool wxApp::Initialize(int argc, wxChar **argv) // we can not enter threads before gtk_init is done gdk_threads_enter(); + if ( !wxAppBase::Initialize(argc, argv) ) + { + gdk_threads_leave(); + + return false; + } + wxSetDetectableAutoRepeat( TRUE ); #if wxUSE_INTL @@ -764,9 +768,9 @@ bool wxApp::Initialize(int argc, wxChar **argv) void wxApp::CleanUp() { - wxAppBase::CleanUp(); - gdk_threads_leave(); + + wxAppBase::CleanUp(); } #ifdef __WXDEBUG__