+bool wxEventLoopManual::ProcessEvents()
+{
+ // process pending wx events first as they correspond to low-level events
+ // which happened before, i.e. typically pending events were queued by a
+ // previous call to Dispatch() and if we didn't process them now the next
+ // call to it might enqueue them again (as happens with e.g. socket events
+ // which would be generated as long as there is input available on socket
+ // and this input is only removed from it when pending event handlers are
+ // executed)
+ if ( wxTheApp )
+ {
+ wxTheApp->ProcessPendingEvents();
+
+ // One of the pending event handlers could have decided to exit the
+ // loop so check for the flag before trying to dispatch more events
+ // (which could block indefinitely if no more are coming).
+ if ( m_shouldExit )
+ return false;
+ }
+
+ return Dispatch();
+}
+