X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9af42efda6c78093872a67180d43d5eeba261fee..713e92905e4c463be1cd8b2b626aec8ffa166420:/include/wx/evtloop.h?ds=inline diff --git a/include/wx/evtloop.h b/include/wx/evtloop.h index 5d78a3bf56..6841c61fd0 100644 --- a/include/wx/evtloop.h +++ b/include/wx/evtloop.h @@ -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: