user32: Support undocumented SC_SIZE flag that can be used to move window.

Fixes main window moving in Quicken 2020.

Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Piotr Caban 2020-07-29 19:07:40 +02:00 committed by Alexandre Julliard
parent 992e3055b5
commit 5bb4e4b36c
3 changed files with 43 additions and 2 deletions

View file

@ -11800,6 +11800,45 @@ static void other_process_proc(HWND hwnd)
CloseHandle(test_done_event);
}
static void test_SC_SIZE(void)
{
HWND hwnd;
RECT rect;
MSG msg;
hwnd = CreateWindowExA(0, "static", NULL, WS_POPUP | WS_VISIBLE,
100, 100, 100, 100, 0, 0, NULL, NULL);
ok(!!hwnd, "CreateWindowEx failed.\n");
GetWindowRect(hwnd, &rect);
ok(rect.left == 100, "rect.left = %d\n", rect.left);
ok(rect.top == 100, "rect.top = %d\n", rect.top);
ok(rect.right == 200, "rect.right = %d\n", rect.right);
ok(rect.bottom == 200, "rect.bottom = %d\n", rect.bottom);
SetCursorPos(100, 100);
PostMessageA(hwnd, WM_SYSCOMMAND, SC_SIZE | 9, MAKELONG(100, 100));
SetCursorPos(110, 100);
PostMessageA(hwnd, WM_MOUSEMOVE, 0, MAKELONG(110, 100));
PostMessageA(hwnd, WM_KEYDOWN, VK_RETURN, 0);
while (GetMessageA(&msg, 0, 0, 0))
{
TranslateMessage(&msg);
DispatchMessageA(&msg);
if (msg.message == WM_SYSCOMMAND) break;
}
GetWindowRect(hwnd, &rect);
ok(rect.left == 110, "rect.left = %d\n", rect.left);
ok(rect.top == 100, "rect.top = %d\n", rect.top);
ok(rect.right == 210, "rect.right = %d\n", rect.right);
ok(rect.bottom == 200, "rect.bottom = %d\n", rect.bottom);
DestroyWindow(hwnd);
}
static void test_other_process_window(const char *argv0)
{
HANDLE window_ready_event, test_done_event;
@ -12022,6 +12061,7 @@ START_TEST(win)
test_window_placement();
test_arrange_iconic_windows();
test_other_process_window(argv[0]);
test_SC_SIZE();
/* add the tests above this line */
if (hhook) UnhookWindowsHookEx(hhook);

View file

@ -2894,7 +2894,7 @@ void WINPOS_SysCommandSizeMove( HWND hwnd, WPARAM wParam )
else
{
if (!DragFullWindows) draw_moving_frame( parent, hdc, &sizingRect, thickframe );
if (hittest == HTCAPTION) OffsetRect( &sizingRect, dx, dy );
if (hittest == HTCAPTION || hittest == HTBORDER) OffsetRect( &sizingRect, dx, dy );
if (ON_LEFT_BORDER(hittest)) sizingRect.left += dx;
else if (ON_RIGHT_BORDER(hittest)) sizingRect.right += dx;
if (ON_TOP_BORDER(hittest)) sizingRect.top += dy;
@ -2902,7 +2902,7 @@ void WINPOS_SysCommandSizeMove( HWND hwnd, WPARAM wParam )
capturePoint = pt;
/* determine the hit location */
if (syscommand == SC_SIZE)
if (syscommand == SC_SIZE && hittest != HTBORDER)
{
WPARAM wpSizingHit = 0;

View file

@ -2851,6 +2851,7 @@ LRESULT CDECL X11DRV_SysCommand( HWND hwnd, WPARAM wparam, LPARAM lparam )
case WMSZ_BOTTOM: dir = _NET_WM_MOVERESIZE_SIZE_BOTTOM; break;
case WMSZ_BOTTOMLEFT: dir = _NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT; break;
case WMSZ_BOTTOMRIGHT: dir = _NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT; break;
case 9: dir = _NET_WM_MOVERESIZE_MOVE; break;
default: dir = _NET_WM_MOVERESIZE_SIZE_KEYBOARD; break;
}
break;