user32: Use top level window as dialog parent for modal dialogs.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2016-04-06 14:40:54 +02:00 committed by Alexandre Julliard
parent 5e65b65219
commit 9da0c00a68

View File

@ -587,24 +587,24 @@ static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCVOID dlgTemplate,
if (modal && owner) if (modal && owner)
{ {
HWND parent; HWND parent;
disabled_owner = owner;
/* /*
* Owner needs to be top level window. We need to duplicate the logic from server, * Owner needs to be top level window. We need to duplicate the logic from server,
* because we need to disable it before creating dialog window. * because we need to disable it before creating dialog window. Note that we do that
* even if dialog has WS_CHILD, but only for modal dialogs, which matched what
* Windows does.
*/ */
while ((GetWindowLongW( disabled_owner, GWL_STYLE ) & (WS_POPUP|WS_CHILD)) == WS_CHILD) while ((GetWindowLongW( owner, GWL_STYLE ) & (WS_POPUP|WS_CHILD)) == WS_CHILD)
{ {
parent = GetParent( disabled_owner ); parent = GetParent( owner );
if (!parent || parent == GetDesktopWindow()) break; if (!parent || parent == GetDesktopWindow()) break;
disabled_owner = parent; owner = parent;
} }
if (IsWindowEnabled( disabled_owner )) if (IsWindowEnabled( owner ))
{ {
flags |= DF_OWNERENABLED; flags |= DF_OWNERENABLED;
disabled_owner = owner;
EnableWindow( disabled_owner, FALSE ); EnableWindow( disabled_owner, FALSE );
} }
else
disabled_owner = NULL;
} }
if (unicode) if (unicode)