From 9da0c00a68c43348c2c00878f9a874dbb260147f Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Wed, 6 Apr 2016 14:40:54 +0200 Subject: [PATCH] user32: Use top level window as dialog parent for modal dialogs. Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard --- dlls/user32/dialog.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/dlls/user32/dialog.c b/dlls/user32/dialog.c index 3ea426d606b..2bacf4da3a3 100644 --- a/dlls/user32/dialog.c +++ b/dlls/user32/dialog.c @@ -587,24 +587,24 @@ static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCVOID dlgTemplate, if (modal && owner) { HWND parent; - disabled_owner = owner; /* * 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; - disabled_owner = parent; + owner = parent; } - if (IsWindowEnabled( disabled_owner )) + if (IsWindowEnabled( owner )) { flags |= DF_OWNERENABLED; + disabled_owner = owner; EnableWindow( disabled_owner, FALSE ); } - else - disabled_owner = NULL; } if (unicode)