[PATCH 03/10] user32: Correctly calculate the client size of a minimized window.
Zebediah Figura
z.figura12 at gmail.com
Mon Feb 18 21:15:55 CST 2019
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
dlls/user32/nonclient.c | 5 +++++
dlls/user32/tests/win.c | 17 ++++++++++-------
2 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/dlls/user32/nonclient.c b/dlls/user32/nonclient.c
index 4444a2c91e..26bb0a01b5 100644
--- a/dlls/user32/nonclient.c
+++ b/dlls/user32/nonclient.c
@@ -414,6 +414,11 @@ LRESULT NC_HandleNCCalcSize( HWND hwnd, WPARAM wparam, RECT *winRect )
if (winRect->left > winRect->right)
winRect->right = winRect->left;
}
+ else
+ {
+ winRect->right = winRect->left;
+ winRect->bottom = winRect->top;
+ }
return result;
}
diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c
index ceb4b82313..127c4aed15 100644
--- a/dlls/user32/tests/win.c
+++ b/dlls/user32/tests/win.c
@@ -6533,7 +6533,6 @@ static void test_ShowWindow(void)
ok(EqualRect(&rcMinimized, &rc), "expected %s, got %s\n",
wine_dbgstr_rect(&rcMinimized), wine_dbgstr_rect(&rc));
GetClientRect(hwnd, &rc);
- todo_wine
ok(EqualRect(&rcEmpty, &rc), "expected %s, got %s\n",
wine_dbgstr_rect(&rcEmpty), wine_dbgstr_rect(&rc));
/* shouldn't be able to resize minimized windows */
@@ -6547,7 +6546,6 @@ static void test_ShowWindow(void)
ok(EqualRect(&rcMinimized, &rc), "expected %s, got %s\n",
wine_dbgstr_rect(&rcMinimized), wine_dbgstr_rect(&rc));
GetClientRect(hwnd, &rc);
- todo_wine
ok(EqualRect(&rcEmpty, &rc), "expected %s, got %s\n",
wine_dbgstr_rect(&rcEmpty), wine_dbgstr_rect(&rc));
/* SetWindowPos shouldn't affect the client rect */
@@ -6559,7 +6557,6 @@ static void test_ShowWindow(void)
ok(EqualRect(&rcMinimized, &rc), "expected %s, got %s\n",
wine_dbgstr_rect(&rcMinimized), wine_dbgstr_rect(&rc));
GetClientRect(hwnd, &rc);
- todo_wine
ok(EqualRect(&rcEmpty, &rc), "expected %s, got %s\n",
wine_dbgstr_rect(&rcEmpty), wine_dbgstr_rect(&rc));
@@ -6651,7 +6648,6 @@ static void test_ShowWindow(void)
ok(EqualRect(&rcMinimized, &rc), "expected %s, got %s\n",
wine_dbgstr_rect(&rcMinimized), wine_dbgstr_rect(&rc));
GetClientRect(hwnd, &rc);
- todo_wine
ok(EqualRect(&rcEmpty, &rc), "expected %s, got %s\n",
wine_dbgstr_rect(&rcEmpty), wine_dbgstr_rect(&rc));
@@ -6667,7 +6663,6 @@ static void test_ShowWindow(void)
ok(EqualRect(&rcMinimized, &rc), "expected %s, got %s\n",
wine_dbgstr_rect(&rcMinimized), wine_dbgstr_rect(&rc));
GetClientRect(hwnd, &rc);
- todo_wine
ok(EqualRect(&rcEmpty, &rc), "expected %s, got %s\n",
wine_dbgstr_rect(&rcEmpty), wine_dbgstr_rect(&rc));
@@ -6710,7 +6705,6 @@ static void test_ShowWindow(void)
ok(EqualRect(&rcMinimized, &rc), "expected %s, got %s\n",
wine_dbgstr_rect(&rcMinimized), wine_dbgstr_rect(&rc));
GetClientRect(hwnd, &rc);
- todo_wine
ok(EqualRect(&rcEmpty, &rc), "expected %s, got %s\n",
wine_dbgstr_rect(&rcEmpty), wine_dbgstr_rect(&rc));
DestroyWindow(hwnd);
@@ -6729,7 +6723,6 @@ static void test_ShowWindow(void)
ok(EqualRect(&rcMinimized, &rc), "expected %s, got %s\n",
wine_dbgstr_rect(&rcMinimized), wine_dbgstr_rect(&rc));
GetClientRect(hwnd, &rc);
- todo_wine
ok(EqualRect(&rcEmpty, &rc), "expected %s, got %s\n",
wine_dbgstr_rect(&rcEmpty), wine_dbgstr_rect(&rc));
DestroyWindow(hwnd);
@@ -10350,6 +10343,7 @@ static void test_hide_window(void)
static void test_minimize_window(HWND hwndMain)
{
HWND hwnd, hwnd2, hwnd3;
+ RECT rc, rc_expect;
hwnd = CreateWindowExA(0, "MainWindowClass", "Main window", WS_POPUP | WS_VISIBLE,
100, 100, 200, 200, 0, 0, GetModuleHandleA(NULL), NULL);
@@ -10458,6 +10452,15 @@ static void test_minimize_window(HWND hwndMain)
DestroyWindow(hwnd3);
DestroyWindow(hwnd2);
DestroyWindow(hwnd);
+
+ /* test NC area */
+ ShowWindow(hwndMain, SW_MINIMIZE);
+ GetWindowRect(hwndMain, &rc);
+ SetRect(&rc_expect, rc.left, rc.top, rc.left, rc.top);
+ DefWindowProcA(hwndMain, WM_NCCALCSIZE, 0, (LPARAM)&rc);
+ ok(EqualRect(&rc, &rc_expect), "expected %s, got %s\n",
+ wine_dbgstr_rect(&rc_expect), wine_dbgstr_rect(&rc));
+ ShowWindow(hwndMain, SW_RESTORE);
}
static void test_desktop( void )
--
2.20.1
More information about the wine-devel
mailing list