]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/evtloop.h
add support for wxStrnlen for those platforms where it's available
[wxWidgets.git] / include / wx / evtloop.h
index 5d78a3bf56f983357128a998eddb0b32816b07c1..6841c61fd0d418ce7107d34f2b21dc33f5b2e593 100644 (file)
@@ -124,11 +124,15 @@ protected:
     #include "wx/msw/evtloop.h"
 #elif defined(__WXMAC__)
     #include "wx/osx/evtloop.h"
+#elif defined(__WXCOCOA__)
+    #include "wx/cocoa/evtloop.h"
 #elif defined(__WXDFB__)
     #include "wx/dfb/evtloop.h"
+#elif defined(__WXGTK20__)
+    #include "wx/gtk/evtloop.h"
 #else // other platform
 
-#define wxNEEDS_GENERIC_DISPATCH_TIMEOUT
+#include "wx/stopwatch.h"   // for wxMilliClock_t
 
 class WXDLLIMPEXP_FWD_CORE wxEventLoopImpl;
 
@@ -142,7 +146,20 @@ public:
     virtual void Exit(int rc = 0);
     virtual bool Pending() const;
     virtual bool Dispatch();
-    virtual int DispatchTimeout(unsigned long timeout);
+    virtual int DispatchTimeout(unsigned long timeout)
+    {
+        // TODO: this is, of course, horribly inefficient and a proper wait with
+        //       timeout should be implemented for all ports natively...
+        const wxMilliClock_t timeEnd = wxGetLocalTimeMillis() + timeout;
+        for ( ;; )
+        {
+            if ( Pending() )
+                return Dispatch();
+
+            if ( wxGetLocalTimeMillis() >= timeEnd )
+                return -1;
+        }
+    }
     virtual void WakeUp() { }
 
 protected: