Dmitry Timoshkov : user32: SetParent() should use ShowWindow() to make a reparented window visible and move a window to new position.

Alexandre Julliard julliard at winehq.org
Mon Apr 2 13:14:52 CDT 2012


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

Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date:   Fri Mar 23 16:57:28 2012 +0800

user32: SetParent() should use ShowWindow() to make a reparented window visible and move a window to new position.

---

 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 3e7d9b1..1cad8aa 100644
--- a/dlls/user32/win.c
+++ b/dlls/user32/win.c
@@ -2787,6 +2787,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))
@@ -2828,6 +2829,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 );
@@ -2849,10 +2853,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;
 }




More information about the wine-cvs mailing list