user32.dll fix and test ShowOwnedPopups

Vitaliy Margolen wine-patch at kievinfo.com
Wed May 11 15:32:23 CDT 2005


ShowOwnedPopups should handle none WS_POPUP style windows as well.
And actually show/hide windows.
Match names for WM_SHOWWINDOW status codes to MSDN

Vitaliy Margolen

changelog:
  include/winuser.h
    Match names for WM_SHOWWINDOW status codes to MSDN
  dlls/user/win.c
    ShowOwnedPopups should handle none WS_POPUP style windows as well.
  dlls/user/tests/win.c
    Tests for ShowOwnedPopups
-------------- next part --------------
Index: dlls/user/win.c
===================================================================
RCS file: /home/wine/wine/dlls/user/win.c,v
retrieving revision 1.3
diff -u -p -r1.3 win.c
--- dlls/user/win.c	7 May 2005 15:03:00 -0000	1.3
+++ dlls/user/win.c	11 May 2005 20:24:11 -0000
@@ -2688,7 +2688,7 @@ BOOL WINAPI ShowOwnedPopups( HWND owner,
         if (!(pWnd = WIN_GetPtr( win_array[count] ))) continue;
         if (pWnd == WND_OTHER_PROCESS) continue;
 
-        if (pWnd->dwStyle & WS_POPUP)
+        /* Native does this for all owned windows, not just WS_POPUP */
         {
             if (fShow)
             {
@@ -2701,6 +2701,7 @@ BOOL WINAPI ShowOwnedPopups( HWND owner,
                      * regardless of the state of the owner
                      */
                     SendMessageW(win_array[count], WM_SHOWWINDOW, SW_SHOW, SW_PARENTOPENING);
+                    ShowWindow(win_array[count], SW_SHOW);
                     continue;
                 }
             }
@@ -2715,6 +2716,7 @@ BOOL WINAPI ShowOwnedPopups( HWND owner,
                      * regardless of the state of the owner
                      */
                     SendMessageW(win_array[count], WM_SHOWWINDOW, SW_HIDE, SW_PARENTCLOSING);
+                    ShowWindow(win_array[count], SW_HIDE);
                     continue;
                 }
             }
Index: dlls/user/tests/win.c
===================================================================
RCS file: /home/wine/wine/dlls/user/tests/win.c,v
retrieving revision 1.57
diff -u -p -r1.57 win.c
--- dlls/user/tests/win.c	26 Apr 2005 08:16:18 -0000	1.57
+++ dlls/user/tests/win.c	11 May 2005 20:24:11 -0000
@@ -2771,6 +2840,45 @@ void test_scroll()
     DestroyWindow( hwnd);
 }
 
+void test_ownedpopups(HWND hwnd)
+{
+    HWND hwnd1, hwnd2, hwnd3;
+    hwnd1 = CreateWindowExA(0, "static", "Window", WS_POPUP,  0, 0, 50, 100, hwnd, 0, 0, NULL);
+    hwnd2 = CreateWindowExA(0, "static", "Window", WS_CAPTION, 0, 55, 50, 100, hwnd, 0, 0, NULL);
+    hwnd3 = CreateWindowExA(0, "static", "Window", WS_CAPTION | WS_SYSMENU, 0, 110, 50, 100, hwnd, 0, 0, NULL);
+
+    ShowWindow(hwnd, SW_SHOW);
+
+    ok(ShowOwnedPopups(hwnd, TRUE), "Failed calling ShowOwnedPopups(%p, TRUE)\n", hwnd);
+    ok(!IsWindowVisible(hwnd1), "Window %p should NOT be visible\n", hwnd1);
+    ok(!IsWindowVisible(hwnd2), "Window %p should NOT be visible\n", hwnd2);
+    ok(!IsWindowVisible(hwnd3), "Window %p should NOT be visible\n", hwnd3);
+    ShowWindow(hwnd1, SW_SHOW);
+    ShowWindow(hwnd2, SW_SHOW);
+    ShowWindow(hwnd3, SW_SHOW);
+    ok(ShowOwnedPopups(hwnd, FALSE), "Failed calling ShowOwnedPopups(%p, FALSE)\n", hwnd);
+    ok(!IsWindowVisible(hwnd1), "Window %p should NOT be visible\n", hwnd1);
+    ok(!IsWindowVisible(hwnd2), "Window %p should NOT be visible\n", hwnd2);
+    ok(!IsWindowVisible(hwnd3), "Window %p should NOT be visible\n", hwnd3);
+    ok(ShowOwnedPopups(hwnd, TRUE), "Failed calling ShowOwnedPopups(%p, TRUE)\n", hwnd);
+    ok(IsWindowVisible(hwnd1), "Window %p should be visible\n", hwnd1);
+    ok(IsWindowVisible(hwnd2), "Window %p should be visible\n", hwnd2);
+    ok(IsWindowVisible(hwnd3), "Window %p should be visible\n", hwnd3);
+    ShowWindow(hwnd1, SW_HIDE);
+    ShowWindow(hwnd2, SW_HIDE);
+    ShowWindow(hwnd3, SW_HIDE);
+    ok(!IsWindowVisible(hwnd1), "Window %p should NOT be visible\n", hwnd1);
+    ok(!IsWindowVisible(hwnd2), "Window %p should NOT be visible\n", hwnd2);
+    ok(!IsWindowVisible(hwnd3), "Window %p should NOT be visible\n", hwnd3);
+    ok(ShowOwnedPopups(hwnd, TRUE), "Failed calling ShowOwnedPopups(%p, TRUE)\n", hwnd);
+    ok(!IsWindowVisible(hwnd1), "Window %p should NOT be visible\n", hwnd1);
+    ok(!IsWindowVisible(hwnd2), "Window %p should NOT be visible\n", hwnd2);
+    ok(!IsWindowVisible(hwnd3), "Window %p should NOT be visible\n", hwnd3);
+    
+    DestroyWindow(hwnd1);
+    DestroyWindow(hwnd2);
+    DestroyWindow(hwnd3);
+}
 
 START_TEST(win)
 {
@@ -2832,6 +2940,7 @@ START_TEST(win)
     test_nccalcscroll( hwndMain);
     test_scrollvalidate( hwndMain);
     test_scroll();
+    test_ownedpopups(hwndMain);
 
     UnhookWindowsHookEx(hhook);
 
Index: include/winuser.h
===================================================================
RCS file: /home/wine/wine/include/winuser.h,v
retrieving revision 1.215
diff -u -p -r1.215 winuser.h
--- include/winuser.h	14 Apr 2005 11:32:28 -0000	1.215
+++ include/winuser.h	11 May 2005 20:29:56 -0000
@@ -3010,11 +3010,11 @@ typedef struct {
     DWORD dwTimeout;
 } FLASHWINFO, *PFLASHWINFO;
 
-/* WM_SHOWWINDOW wParam codes */
+/* WM_SHOWWINDOW lParam codes */
 #define SW_PARENTCLOSING    1
-#define SW_OTHERMAXIMIZED   2
+#define SW_OTHERZOOM        2
 #define SW_PARENTOPENING    3
-#define SW_OTHERRESTORED    4
+#define SW_OTHERUNZOOM      4
 
 /* SetLayeredWindowAttributes() flags */
 #define LWA_COLORKEY        0x00000001


More information about the wine-patches mailing list