From: Vadim Zeitlin Date: Sat, 15 Jun 2002 21:17:37 +0000 (+0000) Subject: argh, another IsDialogMessage() fix: we still need to check all non top level parents X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/48c61225d64bf7364477bf209d0be7ecca7ce6f6 argh, another IsDialogMessage() fix: we still need to check all non top level parents git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15860 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 843b912b13..24a3a73c68 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -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) )