x11drv - ShowWindow(SW_HIDE) - deactivate window if active

Vitaliy Margolen wine-patch at kievinfo.com
Thu Jun 16 00:11:39 CDT 2005


ShowWindow(hwnd, SW_HIDE) should change Z-order and deactivate window if it's
active thus omit SWP_NOZORDER and add SWP_NOACTIVATE to call to SetWindowPos.

It shouldn't be done in SetWindowPos since hiding window (SWP_HIDEWINDOW in
call to SetWindowPos) does not make it inactive. Provide test for this.

But call to ShowWindow(hwnd, SW_HIDE) deactivates window.

This fixes few tests in dlls/user/tests/msg.c

Vitaliy Margolen

changelog:
  dlls/x11drv/winpos.c
    Deactivate active window in ShowWindow(,SW_HIDE)
-------------- next part --------------
Index: dlls/user/tests/msg.c
===================================================================
RCS file: /home/wine/wine/dlls/user/tests/msg.c,v
retrieving revision 1.84
diff -u -p -r1.84 msg.c
--- dlls/user/tests/msg.c	19 Apr 2005 09:48:44 -0000	1.84
+++ dlls/user/tests/msg.c	16 Jun 2005 04:55:40 -0000
@@ -2932,6 +2932,7 @@ static void test_messages(void)
     SetWindowPos(hwnd, 0,0,0,0,0, SWP_HIDEWINDOW|SWP_NOSIZE|SWP_NOMOVE);
     ok_sequence(WmSWP_HideOverlappedSeq, "SetWindowPos:SWP_HIDEWINDOW:overlapped", FALSE);
     ok(!IsWindowVisible(hwnd), "window should not be visible at this point\n");
+    ok(GetActiveWindow() == hwnd, "window should still be active\n");
 
     /* test WM_SETREDRAW on a visible top level window */
     ShowWindow(hwnd, SW_SHOW);
Index: dlls/x11drv/winpos.c
===================================================================
RCS file: /home/wine/wine/dlls/x11drv/winpos.c,v
retrieving revision 1.133
diff -u -p -r1.133 winpos.c
--- dlls/x11drv/winpos.c	25 Mar 2005 16:47:04 -0000	1.133
+++ dlls/x11drv/winpos.c	16 Jun 2005 04:55:54 -0000
@@ -934,7 +934,9 @@ BOOL X11DRV_ShowWindow( HWND hwnd, INT c
         case SW_HIDE:
             if (!wasVisible) return FALSE;
             showFlag = FALSE;
-            swp |= SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER;
+            swp |= SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE;
+            if (hwnd != GetActiveWindow())
+                swp |= SWP_NOACTIVATE | SWP_NOZORDER;
 	    break;
 
 	case SW_SHOWMINNOACTIVE:


More information about the wine-patches mailing list