#include "wx/app.h"
#endif
+#include "wx/thread.h"
#include "wx/timer.h"
#include "wx/private/socketevtdispatch.h"
#include "wx/dfb/private.h"
+#include "wx/nonownedwnd.h"
#define TRACE_EVENTS _T("events")
// NB: we don't block indefinitely waiting for an event, but instead
// time out after a brief period in order to make sure that
// OnNextIteration() will be called frequently enough
- //
- // FIXME: call NotifyTimers() and wxSocketEventDispatcher::RunLoop() from here
- // (and loop) instead?
const int TIMEOUT = 100;
- if ( ms_buffer->WaitForEventWithTimeout(0, TIMEOUT) )
+ // release the GUI mutex so that other threads have a chance to post
+ // events:
+ wxMutexGuiLeave();
+
+ bool rv = ms_buffer->WaitForEventWithTimeout(0, TIMEOUT);
+
+ // and acquire it back before calling any event handlers:
+ wxMutexGuiEnter();
+
+ if ( rv )
{
switch ( ms_buffer->GetLastResult() )
{
void wxEventLoop::OnNextIteration()
{
- // see the comment in Dispatch
-
#if wxUSE_TIMER
wxTimer::NotifyTimers();
#endif
#endif
}
+void wxEventLoop::Yield()
+{
+ // process all pending events:
+ while ( Pending() )
+ Dispatch();
+
+ // handle timers, sockets etc.
+ OnNextIteration();
+}
+
//-----------------------------------------------------------------------------
// DirectFB -> wxWidgets events translation
case DFEC_WINDOW:
{
wxDFBWindowEvent winevent(((const DFBEvent&)event).window);
- wxTopLevelWindowDFB::HandleDFBWindowEvent(winevent);
+ wxNonOwnedWindow::HandleDFBWindowEvent(winevent);
break;
}