Alexandre Julliard : user32: Don' t reinitialize the window placement even if the window rect is empty.

Alexandre Julliard julliard at winehq.org
Wed Sep 17 07:14:41 CDT 2008


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Sep 16 16:29:26 2008 +0200

user32: Don't reinitialize the window placement even if the window rect is empty.

---

 dlls/user32/win.c    |    3 +++
 dlls/user32/winpos.c |   47 ++++++++++++++++-------------------------------
 2 files changed, 19 insertions(+), 31 deletions(-)

diff --git a/dlls/user32/win.c b/dlls/user32/win.c
index 3a7f5db..e1421af 100644
--- a/dlls/user32/win.c
+++ b/dlls/user32/win.c
@@ -1072,6 +1072,9 @@ static HWND WIN_CreateWindowEx( CREATESTRUCTA *cs, LPCWSTR className, UINT flags
     wndPtr->hSysMenu       = 0;
     wndPtr->flags         |= (flags & WIN_ISWIN32);
 
+    wndPtr->min_pos.x = wndPtr->min_pos.y = -1;
+    wndPtr->max_pos.x = wndPtr->max_pos.y = -1;
+
     if (wndPtr->dwStyle & WS_SYSMENU) SetSystemMenu( hwnd, 0 );
 
     /*
diff --git a/dlls/user32/winpos.c b/dlls/user32/winpos.c
index 21e1554..cbe844a 100644
--- a/dlls/user32/winpos.c
+++ b/dlls/user32/winpos.c
@@ -582,36 +582,6 @@ BOOL WINAPI MoveWindow( HWND hwnd, INT x, INT y, INT cx, INT cy,
     return SetWindowPos( hwnd, 0, x, y, cx, cy, flags );
 }
 
-/***********************************************************************
- *           WINPOS_InitPlacement
- */
-static void WINPOS_InitPlacement( WND* wnd )
-{
-    if (IsRectEmpty( &wnd->normal_rect ))
-    {
-	/* this happens when the window is minimized/maximized
-	 * for the first time (rectWindow is not adjusted yet) */
-
-        wnd->normal_rect = wnd->rectWindow;
-        wnd->min_pos.x = wnd->min_pos.y = -1;
-        wnd->max_pos.x = wnd->max_pos.y = -1;
-    }
-
-    if( wnd->dwStyle & WS_MINIMIZE )
-    {
-        wnd->min_pos.x = wnd->rectWindow.left;
-        wnd->min_pos.y = wnd->rectWindow.top;
-    }
-    else if( wnd->dwStyle & WS_MAXIMIZE )
-    {
-        wnd->max_pos.x = wnd->rectWindow.left;
-        wnd->max_pos.y = wnd->rectWindow.top;
-    }
-    else
-    {
-        wnd->normal_rect = wnd->rectWindow;
-    }
-}
 
 /***********************************************************************
  *           WINPOS_RedrawIconTitle
@@ -1201,7 +1171,22 @@ BOOL WINAPI GetWindowPlacement( HWND hwnd, WINDOWPLACEMENT *wndpl )
         return FALSE;
     }
 
-    WINPOS_InitPlacement( pWnd );
+    /* update the placement according to the current style */
+    if (pWnd->dwStyle & WS_MINIMIZE)
+    {
+        pWnd->min_pos.x = pWnd->rectWindow.left;
+        pWnd->min_pos.y = pWnd->rectWindow.top;
+    }
+    else if (pWnd->dwStyle & WS_MAXIMIZE)
+    {
+        pWnd->max_pos.x = pWnd->rectWindow.left;
+        pWnd->max_pos.y = pWnd->rectWindow.top;
+    }
+    else
+    {
+        pWnd->normal_rect = pWnd->rectWindow;
+    }
+
     wndpl->length  = sizeof(*wndpl);
     if( pWnd->dwStyle & WS_MINIMIZE )
         wndpl->showCmd = SW_SHOWMINIMIZED;




More information about the wine-cvs mailing list