]> git.saurik.com Git - wxWidgets.git/blobdiff - src/dfb/evtloop.cpp
wxFileModificationTime return -1, not 0, on error (patch 1624484)
[wxWidgets.git] / src / dfb / evtloop.cpp
index 78bca48df8a374dd731db0c736f013e9f647b9a6..2ecc94a9b4212a7fd3fd0792349df235cdc6e6d7 100644 (file)
@@ -26,6 +26,7 @@
 #endif
 
 #include "wx/timer.h"
 #endif
 
 #include "wx/timer.h"
+#include "wx/private/socketevtdispatch.h"
 #include "wx/dfb/private.h"
 
 #define TRACE_EVENTS _T("events")
 #include "wx/dfb/private.h"
 
 #define TRACE_EVENTS _T("events")
@@ -52,6 +53,12 @@ void wxEventLoop::InitBuffer()
     ms_buffer = wxIDirectFB::Get()->CreateEventBuffer();
 }
 
     ms_buffer = wxIDirectFB::Get()->CreateEventBuffer();
 }
 
+/* static */
+void wxEventLoop::CleanUp()
+{
+    ms_buffer.Reset();
+}
+
 /* static */
 wxIDirectFBEventBufferPtr wxEventLoop::GetDirectFBEventBuffer()
 {
 /* static */
 wxIDirectFBEventBufferPtr wxEventLoop::GetDirectFBEventBuffer()
 {
@@ -79,8 +86,6 @@ bool wxEventLoop::Dispatch()
     // 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
     // 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() from here (and loop) instead?
     const int TIMEOUT = 100;
 
     if ( ms_buffer->WaitForEventWithTimeout(0, TIMEOUT) )
     const int TIMEOUT = 100;
 
     if ( ms_buffer->WaitForEventWithTimeout(0, TIMEOUT) )
@@ -120,12 +125,24 @@ void wxEventLoop::WakeUp()
 void wxEventLoop::OnNextIteration()
 {
 #if wxUSE_TIMER
 void wxEventLoop::OnNextIteration()
 {
 #if wxUSE_TIMER
-    // see the comment in Dispatch
     wxTimer::NotifyTimers();
 #endif
     wxTimer::NotifyTimers();
 #endif
+
+#if wxUSE_SOCKETS
+    // handle any pending socket events:
+    wxSocketEventDispatcher::Get().RunLoop();
+#endif
 }
 
 }
 
-#warning "FIXME: cleanup wxEventLoop::ms_buffer before exiting"
+void wxEventLoop::Yield()
+{
+    // process all pending events:
+    while ( Pending() )
+        Dispatch();
+
+    // handle timers, sockets etc.
+    OnNextIteration();
+}
 
 
 //-----------------------------------------------------------------------------
 
 
 //-----------------------------------------------------------------------------