Ignore attempts to hide an already hidden window

Mike Hearn mh at codeweavers.com
Thu Jun 3 10:55:40 CDT 2004


Replaces the last patch I sent.

Fixes TightVNC. With help from Dmitry Timoshkov.
 
Mike Hearn <mh at codeweavers.com>
Ignore attempts to hide an already invisible window. Add a test case
for this behaviour, passes on Wine and Windows 2000.
 
Index: dlls/x11drv/winpos.c
===================================================================
RCS file: /home/wine/wine/dlls/x11drv/winpos.c,v
retrieving revision 1.83
diff -u -p -r1.83 winpos.c
--- dlls/x11drv/winpos.c        27 Apr 2004 23:32:01 -0000      1.83
+++ dlls/x11drv/winpos.c        3 Jun 2004 15:50:47 -0000
@@ -1283,6 +1283,7 @@ BOOL X11DRV_ShowWindow( HWND hwnd, INT c
     switch(cmd)
     {
         case SW_HIDE:
+           if (!wasVisible) return FALSE;
            swp |= SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE |
                        SWP_NOACTIVATE | SWP_NOZORDER;
            break;
Index: dlls/user/tests/msg.c
===================================================================
RCS file: /home/wine/wine/dlls/user/tests/msg.c,v
retrieving revision 1.21
diff -u -p -r1.21 msg.c
--- dlls/user/tests/msg.c       1 Jun 2004 19:39:26 -0000       1.21
+++ dlls/user/tests/msg.c       3 Jun 2004 15:50:47 -0000
@@ -145,6 +145,10 @@ static const struct message WmHideOverla
     { WM_IME_SETCONTEXT, sent|wparam|optional, 0 },
     { 0 }
 };
+/* ShowWindow(SW_HIDE) for an invisible overlapped window */
+static const struct message WmHideInvisibleOverlappedSeq[] = {
+    { 0 }
+};
 /* DestroyWindow for a visible overlapped window */
 static const struct message WmDestroyOverlappedSeq[] = {
     { HCBT_DESTROYWND, hook },
@@ -749,6 +753,10 @@ static void test_messages(void)
     ok (hwnd != 0, "Failed to create overlapped window\n");
     ok_sequence(WmCreateOverlappedSeq, "CreateWindow:overlapped");
  
+    /* test ShowWindow(SW_HIDE) on a newly created invisible window */
+    ok( ShowWindow(hwnd, SW_HIDE) == FALSE );
+    ok_sequence(WmHideInvisibleOverlappedSeq, "ShowWindow(SW_HIDE):overlapped, invisible");
+
     /* test WM_SETREDRAW on a not visible top level window */
     test_WM_SETREDRAW(hwnd);
  





More information about the wine-patches mailing list