diff --git a/dlls/user32/defwnd.c b/dlls/user32/defwnd.c index c0d1190710b..9cd1298923c 100644 --- a/dlls/user32/defwnd.c +++ b/dlls/user32/defwnd.c @@ -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 diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index 784849b2ba8..78dc55f00a8 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -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);