X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3ac8d3bc52ea44d6cb9fdf31fbae175d30d00fcc..67b81440f079f88e6202a199fd5763af73bbac0f:/src/gtk/app.cpp diff --git a/src/gtk/app.cpp b/src/gtk/app.cpp index c0004485a6..98327a2aee 100644 --- a/src/gtk/app.cpp +++ b/src/gtk/app.cpp @@ -51,6 +51,8 @@ extern bool g_isIdle; bool g_mainThreadLocked = FALSE; +GtkWidget *wxRootWindow = (GtkWidget*) NULL; + //----------------------------------------------------------------------------- // local functions //----------------------------------------------------------------------------- @@ -138,9 +140,6 @@ gint wxapp_idle_callback( gpointer WXUNUSED(data) ) // thread so we must lock it here ourselves gdk_threads_enter(); - /* sent idle event to all who request them */ - while (wxTheApp->ProcessIdle()) { } - /* we don't want any more idle events until the next event is sent to wxGTK */ gtk_idle_remove( wxTheApp->m_idleTag ); @@ -153,6 +152,9 @@ gint wxapp_idle_callback( gpointer WXUNUSED(data) ) emptied */ g_isIdle = TRUE; + /* sent idle event to all who request them */ + while (wxTheApp->ProcessIdle()) { } + // release lock again gdk_threads_leave(); @@ -268,7 +270,7 @@ bool wxApp::OnInitGui() /* on some machines, the default visual is just 256 colours, so we make sure we get the best. this can sometimes be wasteful, of course, but what do these guys pay $30.000 for? */ -/* + if (gdk_visual_get_best() != gdk_visual_get_system()) { GdkVisual* vis = gdk_visual_get_best(); @@ -279,7 +281,9 @@ bool wxApp::OnInitGui() visual = vis; } -*/ + + wxRootWindow = gtk_window_new( GTK_WINDOW_TOPLEVEL ); + gtk_widget_realize( wxRootWindow ); /* Nothing to do for 15, 16, 24, 32 bit displays */ if (visual->depth > 8) return TRUE; @@ -352,11 +356,11 @@ bool wxApp::ProcessIdle() void wxApp::OnIdle( wxIdleEvent &event ) { static bool s_inOnIdle = FALSE; - + /* Avoid recursion (via ProcessEvent default case) */ if (s_inOnIdle) return; - + s_inOnIdle = TRUE; /* Resend in the main thread events which have been prepared in other @@ -366,13 +370,6 @@ void wxApp::OnIdle( wxIdleEvent &event ) /* 'Garbage' collection of windows deleted with Close(). */ DeletePendingObjects(); - /* flush the logged messages if any */ -#if wxUSE_LOG - wxLog *log = wxLog::GetActiveTarget(); - if (log != NULL && log->HasPendingMessages()) - log->Flush(); -#endif // wxUSE_LOG - /* Send OnIdle events to all windows */ bool needMore = SendIdleEvents(); @@ -380,6 +377,13 @@ void wxApp::OnIdle( wxIdleEvent &event ) event.RequestMore(TRUE); s_inOnIdle = FALSE; + + /* flush the logged messages if any */ +#if wxUSE_LOG + wxLog *log = wxLog::GetActiveTarget(); + if (log != NULL && log->HasPendingMessages()) + log->Flush(); +#endif // wxUSE_LOG } bool wxApp::SendIdleEvents() @@ -558,7 +562,17 @@ void wxApp::CleanUp() int wxEntry( int argc, char *argv[] ) { #if wxUSE_THREADS - g_thread_init(NULL); + /* GTK 1.2 up to version 1.2.3 has broken threads */ + if ((gtk_major_version == 1) && + (gtk_minor_version == 2) && + (gtk_micro_version < 4)) + { + printf( "wxWindows warning: Disabled GUI threading due to outdated GTK version\n" ); + } + else + { + g_thread_init(NULL); + } #endif gtk_set_locale();