X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b3eb776ad6e73ff50d3d75e3b7c8f418154feae6..c13d6ac1ea199d1e3908d40d129e2fd5a4d82df7:/src/dfb/evtloop.cpp diff --git a/src/dfb/evtloop.cpp b/src/dfb/evtloop.cpp index 89d0f75388..726ea53b51 100644 --- a/src/dfb/evtloop.cpp +++ b/src/dfb/evtloop.cpp @@ -23,6 +23,7 @@ #ifndef WX_PRECOMP #include "wx/app.h" + #include "wx/log.h" #endif #include "wx/thread.h" @@ -202,12 +203,39 @@ wxIDirectFBEventBufferPtr wxGUIEventLoop::GetDirectFBEventBuffer() // 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; }