From 369da72455352cbf0028616c7015159202070323 Mon Sep 17 00:00:00 2001 From: Mattia Barbon Date: Fri, 14 Feb 2003 20:41:57 +0000 Subject: [PATCH] Fix wxEventLoop so it does not sleep 20 msec between events when threads are anabled. Now the ode should be equivalent to the 2.4 event loop. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19223 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/motif/evtloop.cpp | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/src/motif/evtloop.cpp b/src/motif/evtloop.cpp index 59207e7d8d..0c68418f27 100644 --- a/src/motif/evtloop.cpp +++ b/src/motif/evtloop.cpp @@ -173,7 +173,7 @@ bool wxEventLoop::Dispatch() #else XtAppProcessEvent( context, XtIMTimer|XtIMAlternateInput|XtIMSignal ); #endif - + return m_impl ? m_impl->GetKeepGoing() : true; } @@ -345,17 +345,27 @@ bool CheckForKeyUp(XEvent* event) bool wxDoEventLoopIteration( wxEventLoop& evtLoop ) { + bool moreRequested, pendingEvents; + + for(;;) + { + pendingEvents = evtLoop.Pending(); + if( pendingEvents ) break; + moreRequested = ::SendIdleMessage(); + if( !moreRequested ) break; + } + #if wxUSE_THREADS - // leave the main loop to give other threads a chance to - // perform their GUI work - wxMutexGuiLeave(); - wxUsleep(20); - wxMutexGuiEnter(); + if( !pendingEvents && !moreRequested ) + { + // leave the main loop to give other threads a chance to + // perform their GUI work + wxMutexGuiLeave(); + wxUsleep(20); + wxMutexGuiEnter(); + } #endif - while ( !evtLoop.Pending() && ::SendIdleMessage() ) - ; - if( !evtLoop.Dispatch() ) return false; -- 2.45.2