]> git.saurik.com Git - wxWidgets.git/commitdiff
fix for dialog navigation in the modal dialogs: do call IsDialogMessage() in this...
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 15 Jun 2002 20:09:15 +0000 (20:09 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 15 Jun 2002 20:09:15 +0000 (20:09 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15859 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/window.cpp

index 24d95786207d7821d12bdb7d9d69f3e908ce9719..843b912b1307910c75ea167561c279c83b08cb4d 100644 (file)
@@ -1916,14 +1916,7 @@ bool wxWindowMSW::MSWProcessMessage(WXMSG* pMsg)
         // here we try to do all the job which ::IsDialogMessage() usually does
         // internally
 #if 1
-        bool bProcess = TRUE;
-        if ( msg->message != WM_KEYDOWN )
-            bProcess = FALSE;
-
-        if ( bProcess && (HIWORD(msg->lParam) & KF_ALTDOWN) == KF_ALTDOWN )
-            bProcess = FALSE;
-
-        if ( bProcess )
+        if ( msg->message == WM_KEYDOWN )
         {
             bool bCtrlDown = wxIsCtrlDown();
             bool bShiftDown = wxIsShiftDown();
@@ -1940,6 +1933,8 @@ bool wxWindowMSW::MSWProcessMessage(WXMSG* pMsg)
             bool bForward = TRUE,
                  bWindowChange = FALSE;
 
+            // should we process this message specially?
+            bool bProcess = TRUE;
             switch ( msg->wParam )
             {
                 case VK_TAB:
@@ -2084,24 +2079,21 @@ bool wxWindowMSW::MSWProcessMessage(WXMSG* pMsg)
         // place edit control from being closed with Escape in a dialog
         if ( msg->message != WM_KEYDOWN || msg->wParam != VK_ESCAPE )
         {
-            // ::IsDialogMessage() can enter in an infinite loop when
-            // WS_EX_CONTROLPARENT is specified and the currently focused
-            // window is disabled or hidden, so don't call it in this case
+            // ::IsDialogMessage() can enter in an infinite loop when the
+            // currently focused window is disabled or hidden and its parent
+            // has WS_EX_CONTROLPARENT style, so don't call it in this case
             bool canSafelyCallIsDlgMsg = TRUE;
 
-            HWND hwndFocus = ::GetFocus();
-            while ( hwndFocus )
+            HWND hwnd = ::GetFocus();
+            if ( hwnd && !(::IsWindowEnabled(hwnd) && ::IsWindowVisible(hwnd)) )
             {
-                if ( !::IsWindowEnabled(hwndFocus) ||
-                        !::IsWindowVisible(hwndFocus) )
+                hwnd = ::GetParent(hwnd);
+                if ( hwnd &&
+                      (::GetWindowLong(hwnd, GWL_STYLE) & WS_EX_CONTROLPARENT) )
                 {
                     // it would enter an infinite loop if we do this!
                     canSafelyCallIsDlgMsg = FALSE;
-
-                    break;
                 }
-
-                hwndFocus = ::GetParent(hwndFocus);
             }
 
             if ( canSafelyCallIsDlgMsg && ::IsDialogMessage(GetHwnd(), msg) )