]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/app.cpp
corrected use of Print Manager Session APIs for Carbon targets
[wxWidgets.git] / src / msw / app.cpp
index 3424745eafa1e9eefb0daeeac4afd21b526ccfce..6277236d8e2e7fb87aee80d569c44acc24794286 100644 (file)
@@ -86,7 +86,7 @@
 #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
 
@@ -601,7 +601,9 @@ void wxApp::CleanUp()
 #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();
@@ -955,16 +957,21 @@ bool wxApp::DoMessage()
 #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.
@@ -1054,17 +1061,19 @@ bool wxApp::ProcessMessage(WXMSG *wxmsg)
     // 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;