X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3754265e328a7cc7f67a46a9beea105cf1d49a14..e90411c2c1a2808a7f76667ca683c1e21d11ea09:/src/gtk/evtloop.cpp diff --git a/src/gtk/evtloop.cpp b/src/gtk/evtloop.cpp index acca1472fe..d684ccb0eb 100644 --- a/src/gtk/evtloop.cpp +++ b/src/gtk/evtloop.cpp @@ -17,10 +17,6 @@ // headers // ---------------------------------------------------------------------------- -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) - #pragma implementation "evtloop.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -28,10 +24,8 @@ #pragma hdrstop #endif -#ifndef WX_PRECOMP -#endif //WX_PRECOMP - #include "wx/evtloop.h" +#include "wx/app.h" #include @@ -62,8 +56,6 @@ private: // wxEventLoop running and exiting // ---------------------------------------------------------------------------- -wxEventLoop *wxEventLoopBase::ms_activeLoop = NULL; - wxEventLoop::~wxEventLoop() { wxASSERT_MSG( !m_impl, _T("should have been deleted in Run()") ); @@ -74,8 +66,7 @@ int wxEventLoop::Run() // event loops are not recursive, you need to create another loop! wxCHECK_MSG( !IsRunning(), -1, _T("can't reenter a message loop") ); - wxEventLoop *oldLoop = ms_activeLoop; - ms_activeLoop = this; + wxEventLoopActivator activate(this); m_impl = new wxEventLoopImpl; @@ -85,8 +76,6 @@ int wxEventLoop::Run() delete m_impl; m_impl = NULL; - ms_activeLoop = oldLoop; - return exitcode; } @@ -105,7 +94,14 @@ void wxEventLoop::Exit(int rc) bool wxEventLoop::Pending() const { - return gtk_events_pending() > 0; + if (wxTheApp) + { + // We need to remove idle callbacks or gtk_events_pending will + // never return false. + wxTheApp->RemoveIdleTag(); + } + + return gtk_events_pending(); } bool wxEventLoop::Dispatch()