user32/tests: Do not modify cursor position when simulating clicks.

FVWM by default uses a focus follow mouse model so the window under the mouse cursor automatically
gets focus. Windows explorer.exe and other windows managers use click to focus model. So on FVWM,
if a test changes the cursor position, it might affects other tests that rely on a specific focus
window. Restore the cursor position after sending simulating clicks to avoid affecting other tests
unintentionally. FVWM could be configured to use a click to focus model, but right now it will make
many tests starting to succeed and other tests fail. So it seems to be too big of a change. Flaky
is added to test_SetWindowPos() because this patch makes the tests succeed on Gitlab CI but the same
tests still fails for other window managers and on TestBots.
This commit is contained in:
Zhiyi Zhang 2023-02-27 16:10:15 +08:00 committed by Alexandre Julliard
parent c7d748d2e5
commit 40492eb007

View file

@ -3282,7 +3282,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);
flaky todo_wine check_active_state(hwnd2, hwnd2, hwnd2);
DestroyWindow(hwnd_child);
}
@ -10186,7 +10186,9 @@ static void simulate_click(int x, int y)
{
INPUT input[2];
UINT events_no;
POINT pt;
GetCursorPos(&pt);
SetCursorPos(x, y);
memset(input, 0, sizeof(input));
input[0].type = INPUT_MOUSE;
@ -10199,6 +10201,7 @@ static void simulate_click(int x, int y)
U(input[1]).mi.dwFlags = MOUSEEVENTF_LEFTUP;
events_no = SendInput(2, input, sizeof(input[0]));
ok(events_no == 2, "SendInput returned %d\n", events_no);
SetCursorPos(pt.x, pt.y);
}
static WNDPROC def_static_proc;