X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/86e9b8f28fc8db834628e1528e12f3eeb1f6e216..815f65bd0f673965230ed915d794497a8818dd35:/src/dfb/evtloop.cpp diff --git a/src/dfb/evtloop.cpp b/src/dfb/evtloop.cpp index fd3f6b5818..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" @@ -31,6 +32,8 @@ #include "wx/nonownedwnd.h" #include "wx/buffer.h" +#include + #define TRACE_EVENTS "events" // =========================================================================== @@ -200,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; }