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

Alexandre Julliard julliard at wine.codeweavers.com
Mon Apr 11 10:30:31 CDT 2016


Module: wine
Branch: master
Commit: 9da0c00a68c43348c2c00878f9a874dbb260147f
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=9da0c00a68c43348c2c00878f9a874dbb260147f

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Apr  6 14:40:54 2016 +0200

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

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 3ea426d..2bacf4d 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)




More information about the wine-cvs mailing list