X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bf91e652859f75b2cc6dea7d473424100ff37d2e..6eb37239e0d99d96181310dbd50d92158639a8dc:/src/motif/evtloop.cpp diff --git a/src/motif/evtloop.cpp b/src/motif/evtloop.cpp index 59207e7d8d..f5f5e000df 100644 --- a/src/motif/evtloop.cpp +++ b/src/motif/evtloop.cpp @@ -6,7 +6,7 @@ // Created: 01.11.02 // RCS-ID: $Id$ // Copyright: (c) 2002 Mattia Barbon -// License: wxWindows license +// License: wxWindows licence /////////////////////////////////////////////////////////////////////////////// // ============================================================================ @@ -35,6 +35,7 @@ #include "wx/evtloop.h" #include "wx/event.h" #include "wx/app.h" +#include "wx/window.h" #ifdef __VMS__ #pragma message disable nosimpint @@ -173,7 +174,7 @@ bool wxEventLoop::Dispatch() #else XtAppProcessEvent( context, XtIMTimer|XtIMAlternateInput|XtIMSignal ); #endif - + return m_impl ? m_impl->GetKeepGoing() : true; } @@ -345,17 +346,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; @@ -433,7 +444,7 @@ static void wxInputCallback( XtPointer, int* fd, XtInputId* ) static void wxBreakDispatch() { - char dummy; + char dummy = 0; // for valgrind // check if wxWakeUpIdle has already been called fd_set in;