[1/3] user32: SetParent() should use ShowWindow() to make a reparented window visible and move a window to new position.

Dmitry Timoshkov dmitry at codeweavers.com
Thu Feb 10 02:46:07 CST 2011


SetParent() tests confirm that.
---
 dlls/user32/win.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/dlls/user32/win.c b/dlls/user32/win.c
index b61d183..ba0a4ad 100644
--- a/dlls/user32/win.c
+++ b/dlls/user32/win.c
@@ -2782,6 +2782,7 @@ HWND WINAPI SetParent( HWND hwnd, HWND parent )
     HWND old_parent = 0;
     BOOL was_visible;
     WND *wndPtr;
+    POINT pt;
     BOOL ret;
 
     if (is_broadcast(hwnd) || is_broadcast(parent))
@@ -2823,6 +2824,9 @@ HWND WINAPI SetParent( HWND hwnd, HWND parent )
     wndPtr = WIN_GetPtr( hwnd );
     if (!wndPtr || wndPtr == WND_OTHER_PROCESS || wndPtr == WND_DESKTOP) return 0;
 
+    pt.x = wndPtr->rectWindow.left;
+    pt.y = wndPtr->rectWindow.top;
+
     SERVER_START_REQ( set_parent )
     {
         req->handle = wine_server_user_handle( hwnd );
@@ -2844,10 +2848,9 @@ HWND WINAPI SetParent( HWND hwnd, HWND parent )
        in the x-order and send the expected WM_WINDOWPOSCHANGING and
        WM_WINDOWPOSCHANGED notification messages.
     */
-    SetWindowPos( hwnd, HWND_TOP, 0, 0, 0, 0,
-                  SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | (was_visible ? SWP_SHOWWINDOW : 0) );
-    /* FIXME: a WM_MOVE is also generated (in the DefWindowProc handler
-     * for WM_WINDOWPOSCHANGED) in Windows, should probably remove SWP_NOMOVE */
+    SetWindowPos( hwnd, HWND_TOP, pt.x, pt.y, 0, 0, SWP_NOSIZE );
+
+    if (was_visible) ShowWindow( hwnd, SW_SHOW );
 
     return old_parent;
 }
-- 
1.7.3.5




More information about the wine-patches mailing list