[PATCH] user32: Calculate a window's minimized size even if it's already minimized.
Zebediah Figura
zfigura at codeweavers.com
Fri Jul 14 13:02:51 CDT 2017
Creating a window with the WS_MINIMIZED style currently causes this
function to skip calculating the minimized size. As a result, the
driver's ShowWindow() is called with an empty size, causing it not to
set the position to (-32000,-32000). As a side effect of this, Wine
creates an icon title for the window.
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
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 2399228a323..5806f81bfb2 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 a89c60d4ab0..6b6b26a7c89 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;
--
2.13.2
More information about the wine-patches
mailing list