From 0ceb2550546767b18ec31b18480cd7bd21b6ce6e Mon Sep 17 00:00:00 2001 From: Andrew Lewycky Date: Sun, 19 Mar 2000 14:20:52 +0000 Subject: [PATCH] Propagate IsDialogMessage to the parent if the dialog has the DS_CONTROL flag. --- windows/dialog.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/windows/dialog.c b/windows/dialog.c index c5d40e0284d..92d4da1730f 100644 --- a/windows/dialog.c +++ b/windows/dialog.c @@ -1227,6 +1227,40 @@ static BOOL DIALOG_IsAccelerator( HWND hwnd, HWND hwndDlg, WPARAM vKey ) return RetVal; } +/*********************************************************************** + * DIALOG_FindMsgDestination + * + * The messages that IsDialogMessage send may not go to the dialog + * calling IsDialogMessage if that dialog is a child, and it has the + * DS_CONTROL style set. + * We propagate up until we hit a that does not have DS_CONTROL, or + * whose parent is not a dialog. + * + * This is undocumented behaviour. + */ +static HWND DIALOG_FindMsgDestination( HWND hwndDlg ) +{ + while (GetWindowLongA(hwndDlg, GWL_STYLE) & DS_CONTROL) + { + WND *pParent; + HWND hParent = GetParent(hwndDlg); + if (!hParent) break; + + pParent = WIN_FindWndPtr(hParent); + if (!pParent) break; + + if (!(pParent->flags & WIN_ISDIALOG)) + { + WIN_ReleaseWndPtr(pParent); + break; + } + WIN_ReleaseWndPtr(pParent); + + hwndDlg = hParent; + } + + return hwndDlg; +} /*********************************************************************** * DIALOG_IsDialogMessage @@ -1257,6 +1291,8 @@ static BOOL DIALOG_IsDialogMessage( HWND hwnd, HWND hwndDlg, return TRUE; } + hwndDlg = DIALOG_FindMsgDestination(hwndDlg); + switch(message) { case WM_KEYDOWN: