Zebediah Figura : user32: Calculate a window's minimized size even if it' s already minimized.

Alexandre Julliard julliard at winehq.org
Tue Jul 18 13:58:55 CDT 2017


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

Author: Zebediah Figura <zfigura at codeweavers.com>
Date:   Fri Jul 14 13:02:51 2017 -0500

user32: Calculate a window's minimized size even if it's already minimized.

Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/user32/tests/win.c | 31 +++++++++++++++++++++++++++++++
 dlls/user32/winpos.c    |  5 +++++
 2 files changed, 36 insertions(+)

diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c
index 2399228..5806f81 100644
--- a/dlls/user32/tests/win.c
+++ b/dlls/user32/tests/win.c
@@ -6622,6 +6622,37 @@ static void test_ShowWindow(void)
     ret = DefWindowProcA(hwnd, WM_SYSCOMMAND, SC_CLOSE, 0);
     ok(!ret, "not expected ret: %lu\n", ret);
     ok(!IsWindow(hwnd), "window should not exist\n");
+
+    hwnd = CreateWindowExA(0, "MainWindowClass", NULL,
+                          WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX |
+                          WS_MAXIMIZEBOX | WS_POPUP | WS_MINIMIZE,
+                          rcMain.left, rcMain.top,
+                          rcMain.right - rcMain.left, rcMain.bottom - rcMain.top,
+                          0, 0, 0, NULL);
+    ok(hwnd != NULL, "failed to create window with error %u\n", GetLastError());
+    style = GetWindowLongA(hwnd, GWL_STYLE);
+    ok(style & WS_MINIMIZE, "window should be minimized\n");
+    GetWindowRect(hwnd, &rc);
+    todo_wine
+    ok((rc.left == -32000 || rc.left == 3000) &&
+       (rc.top == -32000 || rc.top == 3000),
+       "expected (-32000,-32000), got (%d,%d)\n", rc.left, rc.top);
+    DestroyWindow(hwnd);
+
+    hwnd = CreateWindowExA(0, "MainWindowClass", NULL,
+                          WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX |
+                          WS_MAXIMIZEBOX | WS_POPUP | WS_MINIMIZE | WS_VISIBLE,
+                          rcMain.left, rcMain.top,
+                          rcMain.right - rcMain.left, rcMain.bottom - rcMain.top,
+                          0, 0, 0, NULL);
+    ok(hwnd != NULL, "failed to create window with error %u\n", GetLastError());
+    style = GetWindowLongA(hwnd, GWL_STYLE);
+    ok(style & WS_MINIMIZE, "window should be minimized\n");
+    GetWindowRect(hwnd, &rc);
+    ok((rc.left == -32000 || rc.left == 3000) &&
+       (rc.top == -32000 || rc.top == 3000),
+       "expected (-32000,-32000), got (%d,%d)\n", rc.left, rc.top);
+    DestroyWindow(hwnd);
 }
 
 static DWORD CALLBACK enablewindow_thread(LPVOID arg)
diff --git a/dlls/user32/winpos.c b/dlls/user32/winpos.c
index a89c60d..6b6b26a 100644
--- a/dlls/user32/winpos.c
+++ b/dlls/user32/winpos.c
@@ -963,6 +963,11 @@ UINT WINPOS_MinMaximize( HWND hwnd, UINT cmd, LPRECT rect )
         case SW_SHOWMINIMIZED:
         case SW_FORCEMINIMIZE:
         case SW_MINIMIZE:
+            wpl.ptMinPosition = WINPOS_FindIconPos( hwnd, wpl.ptMinPosition );
+
+            SetRect( rect, wpl.ptMinPosition.x, wpl.ptMinPosition.y,
+                     wpl.ptMinPosition.x + GetSystemMetrics(SM_CXICON),
+                     wpl.ptMinPosition.y + GetSystemMetrics(SM_CYICON) );
             return SWP_NOSIZE | SWP_NOMOVE;
         }
         if (!SendMessageW( hwnd, WM_QUERYOPEN, 0, 0 )) return SWP_NOSIZE | SWP_NOMOVE;




More information about the wine-cvs mailing list