- for ( ;; )
- {
- #if wxUSE_THREADS
- wxMutexGuiLeaveOrEnter();
- #endif // wxUSE_THREADS
-
- // generate and process idle events for as long as we don't have
- // anything else to do
- while ( !Pending() && m_impl->SendIdleMessage() )
- ;
-
- // if the "should exit" flag is set, the loop should terminate but
- // not before processing any remaining messages so while Pending()
- // returns true, do process them
- if ( m_impl->ShouldExit() )
- {
- while ( Pending() )
- Dispatch();
-
- break;
- }
-
- // a message came or no more idle processing to do, sit in
- // Dispatch() waiting for the next message
- if ( !Dispatch() )
- {
- // we got WM_QUIT
- break;
- }
- }
- }
- wxCATCH_ALL(
- switch (m_impl->OnCatchAll()) {
- case wxEventLoopImpl::catch_continue:
- retryAfterException=true;
- break;
- case wxEventLoopImpl::catch_exit:
- OnExit();
- break;
- case wxEventLoopImpl::catch_rethrow:
- OnExit();
- // should be replaced with wx macro, but
- // there is none yet. OTOH, wxCATCH_ALL isn't
- // expanded unless wxUSE_EXCEPTIONS, so its
- // safe to use throw here.
- throw;
- default:
- break;
+ // if it wasn't done, dispatch it to the corresponding window
+ ::TranslateMessage(msg);
+ ::DispatchMessage(msg);