Commit f8924e3e authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Vitaly Lipatov

user32: Use root dialog for DM_SETDEFID/DM_GETDEFID in DefDlgProc.

This patch fixes DM_SETDEFID/DM_GETDEFID handling in complex dialog structures such as a property sheet.
parent 3d2bbc6c
......@@ -188,6 +188,25 @@ static BOOL DEFDLG_SetDefButton( HWND hwndDlg, DIALOGINFO *dlgInfo, HWND hwndNew
}
static HWND root_dialog(HWND hwnd)
{
while ((GetWindowLongA(hwnd, GWL_EXSTYLE) & WS_EX_CONTROLPARENT) &&
(GetWindowLongA(hwnd, GWL_STYLE) & (WS_CHILD|WS_POPUP)) == WS_CHILD)
{
HWND parent = GetParent(hwnd);
if (!DIALOG_get_info(parent, FALSE))
break;
hwnd = parent;
if (!(GetWindowLongA(hwnd, GWL_STYLE) & DS_CONTROL))
break;
}
return hwnd;
}
/***********************************************************************
* DEFDLG_Proc
*
......@@ -239,11 +258,17 @@ static LRESULT DEFDLG_Proc( HWND hwnd, UINT msg, WPARAM wParam,
return 0;
case DM_SETDEFID:
hwnd = root_dialog( hwnd );
dlgInfo = DIALOG_get_info( hwnd, FALSE );
if (dlgInfo && !(dlgInfo->flags & DF_END))
DEFDLG_SetDefId( hwnd, dlgInfo, wParam );
return 1;
case DM_GETDEFID:
hwnd = root_dialog( hwnd );
dlgInfo = DIALOG_get_info( hwnd, FALSE );
if (dlgInfo && !(dlgInfo->flags & DF_END))
{
HWND hwndDefId;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment