#include <string.h>
#include <ctype.h>
-#if defined(__WIN95__) && !(defined(__GNUWIN32_OLD__) || defined(__TWIN32__))
+#if defined(__WIN95__) && !((defined(__GNUWIN32_OLD__) || defined(__TWIN32__)) && !defined(__CYGWIN10__))
#include <commctrl.h>
#endif
#if wxUSE_THREADS
delete wxPendingEventsLocker;
// If we don't do the following, we get an apparent memory leak.
+#if wxUSE_VALIDATORS
((wxEvtHandler&) wxDefaultValidator).ClearEventLocker();
+#endif
#endif
wxClassInfo::CleanUpClasses();
#endif // wxUSE_THREADS
// Process the message
- if ( !ProcessMessage((WXMSG *)&s_currentMsg) )
- {
- ::TranslateMessage(&s_currentMsg);
- ::DispatchMessage(&s_currentMsg);
- }
+ DoMessage((WXMSG *)&s_currentMsg);
}
return TRUE;
}
+void wxApp::DoMessage(WXMSG *pMsg)
+{
+ if ( !ProcessMessage(pMsg) )
+ {
+ ::TranslateMessage((MSG *)pMsg);
+ ::DispatchMessage((MSG *)pMsg);
+ }
+}
+
/*
* Keep trying to process messages until WM_QUIT
* received.
// a translation table.
wxWindow *wnd;
+ bool pastTopLevelWindow = FALSE;
for ( wnd = wndThis; wnd; wnd = wnd->GetParent() )
{
- if ( wnd->MSWTranslateMessage(wxmsg) )
+ if ( !pastTopLevelWindow && wnd->MSWTranslateMessage(wxmsg))
return TRUE;
- }
-
- // Anyone for a non-translation message? Try youngest descendants first.
- for ( wnd = wndThis; wnd; wnd = wnd->GetParent() )
- {
if ( wnd->MSWProcessMessage(wxmsg) )
return TRUE;
+
+ // stop at first top level window, i.e. don't try to process the key
+ // strokes originating in a dialog using the accelerators of the parent
+ // frame - this doesn't make much sense
+ if ( wnd->IsTopLevel() )
+ pastTopLevelWindow = TRUE;
}
return FALSE;
}
// Yield to incoming messages
+
+static bool gs_inYield = FALSE;
+
bool wxYield()
{
// disable log flushing from here because a call to wxYield() shouldn't
// normally result in message boxes popping up &c
wxLog::Suspend();
+#ifdef __WXDEBUG__
+ if (gs_inYield)
+ wxFAIL_MSG( wxT("wxYield called recursively" ) );
+#endif
+
+ gs_inYield = TRUE;
+
// we don't want to process WM_QUIT from here - it should be processed in
// the main event loop in order to stop it
MSG msg;
// let the logs be flashed again
wxLog::Resume();
+ gs_inYield = FALSE;
+
return TRUE;
}
+// Yield to incoming messages; but fail silently if recursion is detected.
+bool wxYieldIfNeeded()
+{
+ if (gs_inYield)
+ return FALSE;
+
+ return wxYield();
+}
+
bool wxHandleFatalExceptions(bool doit)
{
#if wxUSE_ON_FATAL_EXCEPTION
return TRUE;
#else
wxFAIL_MSG(_T("set wxUSE_ON_FATAL_EXCEPTION to 1 to sue this function"));
-
+
+ (void)doit;
return FALSE;
#endif
}