X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d181e877b04950068cb809b0d3d1a911bea3de74..55410bb4f67febe1ca20654f078ea4fb9a6223ae:/src/gtk/app.cpp diff --git a/src/gtk/app.cpp b/src/gtk/app.cpp index 2847577dde..18c05dda50 100644 --- a/src/gtk/app.cpp +++ b/src/gtk/app.cpp @@ -44,65 +44,6 @@ wxFORCE_LINK_MODULE(gnome_vfs) #endif -//----------------------------------------------------------------------------- -// global data -//----------------------------------------------------------------------------- - -static GtkWidget *gs_RootWindow = (GtkWidget*) NULL; - -//----------------------------------------------------------------------------- -// wxYield -//----------------------------------------------------------------------------- - -bool wxApp::Yield(bool onlyIfNeeded) -{ - if ( m_isInsideYield ) - { - if ( !onlyIfNeeded ) - { - wxFAIL_MSG( wxT("wxYield called recursively" ) ); - } - - return false; - } - -#if wxUSE_THREADS - if ( !wxThread::IsMain() ) - { - // can't call gtk_main_iteration() from other threads like this - return true; - } -#endif // wxUSE_THREADS - - m_isInsideYield = true; - -#if wxUSE_LOG - // disable log flushing from here because a call to wxYield() shouldn't - // normally result in message boxes popping up &c - wxLog::Suspend(); -#endif - - while (EventsPending()) - gtk_main_iteration(); - - // It's necessary to call ProcessIdle() to update the frames sizes which - // might have been changed (it also will update other things set from - // OnUpdateUI() which is a nice (and desired) side effect). But we - // call ProcessIdle() only once since this is not meant for longish - // background jobs (controlled by wxIdleEvent::RequestMore() and the - // return value of Processidle(). - ProcessIdle(); - -#if wxUSE_LOG - // let the logs be flashed again - wxLog::Resume(); -#endif - - m_isInsideYield = false; - - return true; -} - //----------------------------------------------------------------------------- // local functions //----------------------------------------------------------------------------- @@ -222,12 +163,14 @@ bool wxApp::DoIdle() GtkWidget* wxGetRootWindow() { - if (gs_RootWindow == NULL) + static GtkWidget *s_RootWindow = NULL; + + if (s_RootWindow == NULL) { - gs_RootWindow = gtk_window_new( GTK_WINDOW_TOPLEVEL ); - gtk_widget_realize( gs_RootWindow ); + s_RootWindow = gtk_window_new( GTK_WINDOW_TOPLEVEL ); + gtk_widget_realize( s_RootWindow ); } - return gs_RootWindow; + return s_RootWindow; } //-----------------------------------------------------------------------------