X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6c9a19aabab3a878b565e6c2a5f2a3824277c4dc..bc8b8220f8be20dfc56112e104c9900325d1874e:/src/gtk/evtloop.cpp?ds=inline diff --git a/src/gtk/evtloop.cpp b/src/gtk/evtloop.cpp index c602dead45..d684ccb0eb 100644 --- a/src/gtk/evtloop.cpp +++ b/src/gtk/evtloop.cpp @@ -17,10 +17,6 @@ // headers // ---------------------------------------------------------------------------- -#ifdef __GNUG__ - #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,25 +56,17 @@ private: // wxEventLoop running and exiting // ---------------------------------------------------------------------------- -wxEventLoop *wxEventLoop::ms_activeLoop = NULL; - wxEventLoop::~wxEventLoop() { wxASSERT_MSG( !m_impl, _T("should have been deleted in Run()") ); } -bool wxEventLoop::IsRunning() const -{ - return m_impl != NULL; -} - 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; @@ -90,8 +76,6 @@ int wxEventLoop::Run() delete m_impl; m_impl = NULL; - ms_activeLoop = oldLoop; - return exitcode; } @@ -110,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()