user32: WM_MOUSEACTIVATE should return MA_NOACTIVATE for WM_LBUTTONDOWN/HTCAPTION message.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47945
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alistair Leslie-Hughes 2019-11-01 03:07:19 +00:00 committed by Alexandre Julliard
parent ae1291cbe0
commit 71d35d8940
2 changed files with 32 additions and 30 deletions

View File

@ -409,7 +409,7 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa
}
/* Caption clicks are handled by NC_HandleNCLButtonDown() */
return MA_ACTIVATE;
return ( HIWORD(lParam) == WM_LBUTTONDOWN && LOWORD(lParam) == HTCAPTION ? MA_NOACTIVATE : MA_ACTIVATE );
case WM_ACTIVATE:
/* The default action in Windows is to set the keyboard focus to

View File

@ -2717,7 +2717,7 @@ static void test_SetWindowPos(HWND hwnd, HWND hwnd2)
ret = SetWindowPos(hwnd_child, NULL, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_SHOWWINDOW);
ok(ret, "Got %d\n", ret);
flush_events( TRUE );
todo_wine check_active_state(hwnd2, hwnd2, hwnd2);
check_active_state(hwnd2, hwnd2, hwnd2);
DestroyWindow(hwnd_child);
}
@ -3371,8 +3371,8 @@ static void test_SetForegroundWindow(HWND hwnd)
while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
if (0) check_wnd_state(hwnd2, hwnd2, hwnd2, 0);
todo_wine ok(GetActiveWindow() == hwnd2, "Expected active window %p, got %p.\n", hwnd2, GetActiveWindow());
todo_wine ok(GetFocus() == hwnd2, "Expected focus window %p, got %p.\n", hwnd2, GetFocus());
ok(GetActiveWindow() == hwnd2, "Expected active window %p, got %p.\n", hwnd2, GetActiveWindow());
ok(GetFocus() == hwnd2, "Expected focus window %p, got %p.\n", hwnd2, GetFocus());
SetForegroundWindow(hwnd);
check_wnd_state(hwnd, hwnd, hwnd, 0);
@ -3936,34 +3936,36 @@ static void test_mouse_input(HWND hwnd)
ok(peek_message(&msg), "no message available\n");
/* Test WM_MOUSEACTIVATE */
#define TEST_MOUSEACTIVATE(A,B) \
#define TEST_MOUSEACTIVATE(A,B,C) \
res = SendMessageA(hwnd, WM_MOUSEACTIVATE, (WPARAM)hwnd, (LPARAM)MAKELRESULT(A,0)); \
ok(res == B, "WM_MOUSEACTIVATE for %s returned %ld\n", #A, res);
ok(res == B, "WM_MOUSEACTIVATE for %s returned %ld\n", #A, res); \
res = SendMessageA(hwnd, WM_MOUSEACTIVATE, (WPARAM)hwnd, (LPARAM)MAKELRESULT(A,WM_LBUTTONDOWN)); \
ok(res == C, "WM_MOUSEACTIVATE for %s returned %ld\n", #A, res);
TEST_MOUSEACTIVATE(HTERROR,MA_ACTIVATE);
TEST_MOUSEACTIVATE(HTTRANSPARENT,MA_ACTIVATE);
TEST_MOUSEACTIVATE(HTNOWHERE,MA_ACTIVATE);
TEST_MOUSEACTIVATE(HTCLIENT,MA_ACTIVATE);
TEST_MOUSEACTIVATE(HTCAPTION,MA_ACTIVATE);
TEST_MOUSEACTIVATE(HTSYSMENU,MA_ACTIVATE);
TEST_MOUSEACTIVATE(HTSIZE,MA_ACTIVATE);
TEST_MOUSEACTIVATE(HTMENU,MA_ACTIVATE);
TEST_MOUSEACTIVATE(HTHSCROLL,MA_ACTIVATE);
TEST_MOUSEACTIVATE(HTVSCROLL,MA_ACTIVATE);
TEST_MOUSEACTIVATE(HTMINBUTTON,MA_ACTIVATE);
TEST_MOUSEACTIVATE(HTMAXBUTTON,MA_ACTIVATE);
TEST_MOUSEACTIVATE(HTLEFT,MA_ACTIVATE);
TEST_MOUSEACTIVATE(HTRIGHT,MA_ACTIVATE);
TEST_MOUSEACTIVATE(HTTOP,MA_ACTIVATE);
TEST_MOUSEACTIVATE(HTTOPLEFT,MA_ACTIVATE);
TEST_MOUSEACTIVATE(HTTOPRIGHT,MA_ACTIVATE);
TEST_MOUSEACTIVATE(HTBOTTOM,MA_ACTIVATE);
TEST_MOUSEACTIVATE(HTBOTTOMLEFT,MA_ACTIVATE);
TEST_MOUSEACTIVATE(HTBOTTOMRIGHT,MA_ACTIVATE);
TEST_MOUSEACTIVATE(HTBORDER,MA_ACTIVATE);
TEST_MOUSEACTIVATE(HTOBJECT,MA_ACTIVATE);
TEST_MOUSEACTIVATE(HTCLOSE,MA_ACTIVATE);
TEST_MOUSEACTIVATE(HTHELP,MA_ACTIVATE);
TEST_MOUSEACTIVATE(HTERROR, MA_ACTIVATE, MA_ACTIVATE);
TEST_MOUSEACTIVATE(HTTRANSPARENT, MA_ACTIVATE, MA_ACTIVATE);
TEST_MOUSEACTIVATE(HTNOWHERE, MA_ACTIVATE, MA_ACTIVATE);
TEST_MOUSEACTIVATE(HTCLIENT, MA_ACTIVATE, MA_ACTIVATE);
TEST_MOUSEACTIVATE(HTCAPTION, MA_ACTIVATE, MA_NOACTIVATE);
TEST_MOUSEACTIVATE(HTSYSMENU, MA_ACTIVATE, MA_ACTIVATE);
TEST_MOUSEACTIVATE(HTSIZE, MA_ACTIVATE, MA_ACTIVATE);
TEST_MOUSEACTIVATE(HTMENU, MA_ACTIVATE, MA_ACTIVATE);
TEST_MOUSEACTIVATE(HTHSCROLL, MA_ACTIVATE, MA_ACTIVATE);
TEST_MOUSEACTIVATE(HTVSCROLL, MA_ACTIVATE, MA_ACTIVATE);
TEST_MOUSEACTIVATE(HTMINBUTTON, MA_ACTIVATE, MA_ACTIVATE);
TEST_MOUSEACTIVATE(HTMAXBUTTON, MA_ACTIVATE, MA_ACTIVATE);
TEST_MOUSEACTIVATE(HTLEFT, MA_ACTIVATE, MA_ACTIVATE);
TEST_MOUSEACTIVATE(HTRIGHT, MA_ACTIVATE, MA_ACTIVATE);
TEST_MOUSEACTIVATE(HTTOP, MA_ACTIVATE, MA_ACTIVATE);
TEST_MOUSEACTIVATE(HTTOPLEFT, MA_ACTIVATE, MA_ACTIVATE);
TEST_MOUSEACTIVATE(HTTOPRIGHT, MA_ACTIVATE, MA_ACTIVATE);
TEST_MOUSEACTIVATE(HTBOTTOM, MA_ACTIVATE, MA_ACTIVATE);
TEST_MOUSEACTIVATE(HTBOTTOMLEFT, MA_ACTIVATE, MA_ACTIVATE);
TEST_MOUSEACTIVATE(HTBOTTOMRIGHT, MA_ACTIVATE, MA_ACTIVATE);
TEST_MOUSEACTIVATE(HTBORDER, MA_ACTIVATE, MA_ACTIVATE);
TEST_MOUSEACTIVATE(HTOBJECT, MA_ACTIVATE, MA_ACTIVATE);
TEST_MOUSEACTIVATE(HTCLOSE, MA_ACTIVATE, MA_ACTIVATE);
TEST_MOUSEACTIVATE(HTHELP, MA_ACTIVATE, MA_ACTIVATE);
ShowWindow(popup, SW_HIDE);