X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2ddff00c923d454f651aba32c8fe3654fd303e43..00414faf347879152e3a2eb9a3603042631f260b:/src/common/evtloopcmn.cpp?ds=inline diff --git a/src/common/evtloopcmn.cpp b/src/common/evtloopcmn.cpp index e90bf2f2eb..997718b44a 100644 --- a/src/common/evtloopcmn.cpp +++ b/src/common/evtloopcmn.cpp @@ -37,7 +37,7 @@ wxEventLoopBase *wxEventLoopBase::ms_activeLoop = NULL; // wxEventLoopManual is unused in the other ports -#if defined(__WXMSW__) || defined(__WXMAC__) || defined(__WXDFB__) || (defined(__UNIX__) && !wxUSE_GUI) +#if defined(__WXMSW__) || defined(__WXMAC__) || defined(__WXDFB__) || (defined(__UNIX__) && wxUSE_BASE) // ============================================================================ // wxEventLoopManual implementation @@ -153,3 +153,23 @@ void wxEventLoopManual::Exit(int rc) } #endif // __WXMSW__ || __WXMAC__ || __WXDFB__ + +#ifdef wxNEEDS_GENERIC_DISPATCH_TIMEOUT + +int wxGUIEventLoop::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; + } +} + +#endif // wxNEEDS_GENERIC_DISPATCH_TIMEOUT +