x11drv: ShowWindow(SW_MAXIMIZE) should ignore WS_MAXIMIZE [bug1735]

Vitaliy Margolen wine-patch at kievinfo.com
Tue Oct 11 18:30:18 CDT 2005


With some tests to show the correct behavior. This causing problems when window
is created with WS_MAXIMIZED state set, but had it's size changed before call
ShowWindow. This affects Delphi programs that read their design time state from
the resources. Which most of the time doesn't have correct maximized size.

Vitaliy Margolen

changelog:
  x11drv:
  - ShowWindow(SW_MAXIMIZE) should ignore window's maximized state.
-------------- next part --------------
Index: dlls/x11drv/winpos.c
===================================================================
RCS file: /home/wine/wine/dlls/x11drv/winpos.c,v
retrieving revision 1.139
diff -u -p -r1.139 winpos.c
--- dlls/x11drv/winpos.c	28 Sep 2005 15:13:10 -0000	1.139
+++ dlls/x11drv/winpos.c	11 Oct 2005 23:20:52 -0000
@@ -966,9 +966,7 @@ BOOL X11DRV_ShowWindow( HWND hwnd, INT c
 
 	case SW_SHOWMAXIMIZED: /* same as SW_MAXIMIZE */
             swp |= SWP_SHOWWINDOW | SWP_FRAMECHANGED;
-            if( !(style & WS_MAXIMIZE) )
-		 swp |= WINPOS_MinMaximize( hwnd, SW_MAXIMIZE, &newPos );
-            else swp |= SWP_NOSIZE | SWP_NOMOVE;
+            swp |= WINPOS_MinMaximize( hwnd, SW_MAXIMIZE, &newPos );
             break;
 
 	case SW_SHOWNA:
Index: dlls/user/tests/win.c
===================================================================
RCS file: /home/wine/wine/dlls/user/tests/win.c,v
retrieving revision 1.72
diff -u -p -r1.72 win.c
--- dlls/user/tests/win.c	3 Oct 2005 11:06:14 -0000	1.72
+++ dlls/user/tests/win.c	11 Oct 2005 23:20:34 -0000
@@ -3417,6 +3417,38 @@ static void test_IsWindowUnicode(void)
     DestroyWindow(hwnd);
 }
 
+static void test_ShowWindow(void)
+{
+    HWND hwnd;
+    RECT rc;
+
+    /* Test maximized window with resetting it's size */
+    hwnd = CreateWindowA("MainWindowClass", "test_ShowWindow", WS_POPUP | WS_MAXIMIZE,
+                         CW_USEDEFAULT, CW_USEDEFAULT, 100, 100, NULL, NULL, 0, NULL);
+    assert(hwnd);
+
+    GetWindowRect(hwnd, &rc);
+    ok( rc.right-rc.left == GetSystemMetrics(SM_CXSCREEN) &&
+        rc.bottom-rc.top == GetSystemMetrics(SM_CYSCREEN),
+        "Invalid maximized size before ShowWindow (%ld,%ld)-(%ld,%ld)\n",
+        rc.left, rc.top, rc.right, rc.bottom);
+    /* Reset window's size */
+    SetWindowPos(hwnd, 0, 10, 10, 200, 200, SWP_NOZORDER | SWP_NOACTIVATE);
+    GetWindowRect(hwnd, &rc);
+    ok( rc.left == 10 && rc.top == 10 && rc.right == 210 && rc.bottom == 210,
+        "Invalid reset size before ShowWindow (%ld,%ld)-(%ld,%ld)\n",
+        rc.left, rc.top, rc.right, rc.bottom);
+    /* Show window maximized */
+    ShowWindow(hwnd, SW_SHOWMAXIMIZED);
+    GetWindowRect(hwnd, &rc);
+    ok( rc.right-rc.left == GetSystemMetrics(SM_CXSCREEN) &&
+        rc.bottom-rc.top == GetSystemMetrics(SM_CYSCREEN),
+        "Invalid maximized size after ShowWindow (%ld,%ld)-(%ld,%ld)\n",
+        rc.left, rc.top, rc.right, rc.bottom);
+
+    DestroyWindow(hwnd);
+}
+
 START_TEST(win)
 {
     pGetAncestor = (void *)GetProcAddress( GetModuleHandleA("user32.dll"), "GetAncestor" );
@@ -3490,4 +3522,5 @@ START_TEST(win)
     test_window_styles();
     test_redrawnow();
     test_csparentdc();
+    test_ShowWindow();
 }


More information about the wine-patches mailing list