]> git.saurik.com Git - wxWidgets.git/commitdiff
argh, another IsDialogMessage() fix: we still need to check all non top level parents
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 15 Jun 2002 21:17:37 +0000 (21:17 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 15 Jun 2002 21:17:37 +0000 (21:17 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15860 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/window.cpp

index 843b912b1307910c75ea167561c279c83b08cb4d..24a3a73c68b23e797378fbf34a43c24c6e80b0b3 100644 (file)
@@ -2084,16 +2084,27 @@ bool wxWindowMSW::MSWProcessMessage(WXMSG* pMsg)
             // has WS_EX_CONTROLPARENT style, so don't call it in this case
             bool canSafelyCallIsDlgMsg = TRUE;
 
-            HWND hwnd = ::GetFocus();
-            if ( hwnd && !(::IsWindowEnabled(hwnd) && ::IsWindowVisible(hwnd)) )
+            HWND hwndFocus = ::GetFocus();
+            while ( hwndFocus )
             {
-                hwnd = ::GetParent(hwnd);
-                if ( hwnd &&
-                      (::GetWindowLong(hwnd, GWL_STYLE) & WS_EX_CONTROLPARENT) )
+                if ( !::IsWindowEnabled(hwndFocus) ||
+                        !::IsWindowVisible(hwndFocus) )
                 {
                     // it would enter an infinite loop if we do this!
                     canSafelyCallIsDlgMsg = FALSE;
+
+                    break;
+                }
+
+                if ( !(::GetWindowLong(hwndFocus, GWL_STYLE) & WS_CHILD) )
+                {
+                    // it's a top level window, don't go further -- e.g. even
+                    // if the parent of a dialog is disabled, this doesn't
+                    // break navigation inside the dialog
+                    break;
                 }
+
+                hwndFocus = ::GetParent(hwndFocus);
             }
 
             if ( canSafelyCallIsDlgMsg && ::IsDialogMessage(GetHwnd(), msg) )