Jacek Caban : user32: Move MDI child coordinates fixup out of WIN_FixCoordinates.

Alexandre Julliard julliard at winehq.org
Fri Mar 18 16:39:53 CDT 2022


Module: wine
Branch: master
Commit: f2f07d5ba7950c377da392c5ca840a3fca1894e4
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=f2f07d5ba7950c377da392c5ca840a3fca1894e4

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Mar 18 14:27:19 2022 +0100

user32: Move MDI child coordinates fixup out of WIN_FixCoordinates.

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

---

 dlls/user32/win.c | 53 ++++++++++++++++++++++++++---------------------------
 1 file changed, 26 insertions(+), 27 deletions(-)

diff --git a/dlls/user32/win.c b/dlls/user32/win.c
index 22227c23280..db5158c0b6f 100644
--- a/dlls/user32/win.c
+++ b/dlls/user32/win.c
@@ -716,35 +716,10 @@ other_process:
 static void WIN_FixCoordinates( CREATESTRUCTW *cs, INT *sw)
 {
 #define IS_DEFAULT(x)  ((x) == CW_USEDEFAULT || (x) == (SHORT)0x8000)
-    POINT pos[2];
-
-    if (cs->dwExStyle & WS_EX_MDICHILD)
-    {
-        UINT id = 0;
-
-        MDI_CalcDefaultChildPos(cs->hwndParent, -1, pos, 0, &id);
-        if (!(cs->style & WS_POPUP)) cs->hMenu = ULongToHandle(id);
-
-        TRACE("MDI child id %04x\n", id);
-    }
-
     if (cs->style & (WS_CHILD | WS_POPUP))
     {
-        if (cs->dwExStyle & WS_EX_MDICHILD)
-        {
-            if (IS_DEFAULT(cs->x))
-            {
-                cs->x = pos[0].x;
-                cs->y = pos[0].y;
-            }
-            if (IS_DEFAULT(cs->cx) || !cs->cx) cs->cx = pos[1].x;
-            if (IS_DEFAULT(cs->cy) || !cs->cy) cs->cy = pos[1].y;
-        }
-        else
-        {
-            if (IS_DEFAULT(cs->x)) cs->x = cs->y = 0;
-            if (IS_DEFAULT(cs->cx)) cs->cx = cs->cy = 0;
-        }
+        if (IS_DEFAULT(cs->x)) cs->x = cs->y = 0;
+        if (IS_DEFAULT(cs->cx)) cs->cx = cs->cy = 0;
     }
     else  /* overlapped window */
     {
@@ -905,6 +880,11 @@ static void dump_window_styles( DWORD style, DWORD exstyle )
 #undef DUMPED_EX_STYLES
 }
 
+static BOOL is_default_coord( int x )
+{
+    return x == CW_USEDEFAULT || x == 0x8000;
+}
+
 /***********************************************************************
  *           map_dpi_create_struct
  */
@@ -971,6 +951,9 @@ HWND WIN_CreateWindowEx( CREATESTRUCTW *cs, LPCWSTR className, HINSTANCE module,
     /* Fix the styles for MDI children */
     if (cs->dwExStyle & WS_EX_MDICHILD)
     {
+        POINT pos[2];
+        UINT id = 0;
+
         if (!(win_get_flags( cs->hwndParent ) & WIN_ISMDICLIENT))
         {
             WARN("WS_EX_MDICHILD, but parent %p is not MDIClient\n", cs->hwndParent);
@@ -1029,6 +1012,22 @@ HWND WIN_CreateWindowEx( CREATESTRUCTW *cs, LPCWSTR className, HINSTANCE module,
                 else NtUserShowWindow( top_child, SW_SHOWNORMAL );
             }
         }
+
+        MDI_CalcDefaultChildPos( cs->hwndParent, -1, pos, 0, &id );
+        if (!(cs->style & WS_POPUP)) cs->hMenu = ULongToHandle(id);
+
+        TRACE( "MDI child id %04x\n", id );
+
+        if (cs->style & (WS_CHILD | WS_POPUP))
+        {
+            if (is_default_coord( cs->x ))
+            {
+                cs->x = pos[0].x;
+                cs->y = pos[0].y;
+            }
+            if (is_default_coord( cs->cx ) || !cs->cx) cs->cx = pos[1].x;
+            if (is_default_coord( cs->cy ) || !cs->cy) cs->cy = pos[1].y;
+        }
     }
 
     /* Find the parent window */




More information about the wine-cvs mailing list