#ifndef WX_PRECOMP
#include "wx/app.h"
+ #include "wx/log.h"
#endif
#include "wx/thread.h"
// events dispatch and loop handling
//-----------------------------------------------------------------------------
-void wxGUIEventLoop::Yield()
+bool wxGUIEventLoop::YieldFor(long eventsToProcess)
{
+#if wxUSE_THREADS
+ if ( !wxThread::IsMain() )
+ return true; // can't process events from other threads
+#endif // wxUSE_THREADS
+
+ m_isInsideYield = true;
+ m_eventsToProcessInsideYield = eventsToProcess;
+
+#if wxUSE_LOG
+ wxLog::Suspend();
+#endif // wxUSE_LOG
+
+ // TODO: implement event filtering using the eventsToProcess mask
+
// process all pending events:
while ( Pending() )
Dispatch();
// handle timers, sockets etc.
OnNextIteration();
+
+ // 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)
+ while ( ProcessIdle() ) {}
+
+#if wxUSE_LOG
+ wxLog::Resume();
+#endif // wxUSE_LOG
+
+ m_isInsideYield = false;
+
+ return true;
}