// globals
// ----------------------------------------------------------------------------
-wxEventLoop *wxEventLoopBase::ms_activeLoop = NULL;
+wxEventLoopBase *wxEventLoopBase::ms_activeLoop = NULL;
// wxEventLoopManual is unused in the other ports
-#if defined(__WXMSW__) || defined(__WXMAC__) || defined(__WXDFB__)
+#if defined(__WXMSW__) || defined(__WXMAC__) || defined(__WXDFB__) || (defined(__UNIX__) && wxUSE_BASE)
// ============================================================================
// wxEventLoopManual implementation
// ProcessIdle() and Dispatch() below may throw so the code here should
// be exception-safe, hence we must use local objects for all actions we
// should undo
- wxEventLoopActivator activate(wx_static_cast(wxEventLoop *, this));
+ wxEventLoopActivator activate(this);
// we must ensure that OnExit() is called even if an exception is thrown
// from inside Dispatch() but we must call it from Exit() in normal
}
#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
+