-- v2: server: Don't send WM_MOUSEMOVE for zero movement in queue_mouse_message(). win32u: Generate mouse events in the server when releasing capture.
From: Paul Gofman pgofman@codeweavers.com
--- dlls/user32/tests/win.c | 4 ++++ dlls/win32u/input.c | 9 --------- server/queue.c | 2 ++ 3 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index 160d85f2190..8da4e11b635 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -13331,7 +13331,11 @@ static void test_ReleaseCapture(void) ok(wm_mousemove_count < 10, "Got too many WM_MOUSEMOVE.\n");
/* Test that ReleaseCapture() should send a WM_MOUSEMOVE if a window is captured */ + wm_mousemove_count = 0; SetCapture(hwnd); + flush_events(TRUE); + ok(!wm_mousemove_count, "Got no WM_MOUSEMOVE.\n"); + wm_mousemove_count = 0; ret = ReleaseCapture(); ok(ret, "ReleaseCapture failed, error %#lx.\n", GetLastError()); diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c index ae7aeba90f7..69bd026c054 100644 --- a/dlls/win32u/input.c +++ b/dlls/win32u/input.c @@ -1850,15 +1850,6 @@ BOOL release_capture(void) BOOL ret;
ret = set_capture_window( 0, 0, &previous ); - - /* Somebody may have missed some mouse movements */ - if (ret && previous) - { - INPUT input = { .type = INPUT_MOUSE }; - input.mi.dwFlags = MOUSEEVENTF_MOVE; - NtUserSendInput( 1, &input, sizeof(input) ); - } - return ret; }
diff --git a/server/queue.c b/server/queue.c index 76a82dcf712..466e135f278 100644 --- a/server/queue.c +++ b/server/queue.c @@ -3890,6 +3890,8 @@ DECL_HANDLER(set_capture_window) reply->full_handle = shared->capture; } SHARED_WRITE_END; + if (reply->previous && !req->handle && !req->flags) + update_cursor_pos(input->desktop); } }
From: Paul Gofman pgofman@codeweavers.com
--- dlls/user32/tests/input.c | 1 + server/queue.c | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/user32/tests/input.c b/dlls/user32/tests/input.c index 9196e67c15b..eb548ea0924 100644 --- a/dlls/user32/tests/input.c +++ b/dlls/user32/tests/input.c @@ -4131,6 +4131,7 @@ static void test_SendInput_mouse_messages(void)
mouse_event( MOUSEEVENTF_MOVE, 0, 0, 0, 0 ); /* recent Windows versions don't call the hooks with no movement */ + ok(!current_sequence_len || broken(current_sequence_len) /* before Win10 1709 */, "got %ld.\n", current_sequence_len); if (current_sequence_len) { ok_seq( mouse_move ); diff --git a/server/queue.c b/server/queue.c index 466e135f278..3e19d579eec 100644 --- a/server/queue.c +++ b/server/queue.c @@ -2250,15 +2250,14 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons { x = input->mouse.x; y = input->mouse.y; - if (flags & ~(MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE) && - x == desktop_shm->cursor.x && y == desktop_shm->cursor.y) - flags &= ~MOUSEEVENTF_MOVE; } else { x = desktop_shm->cursor.x + input->mouse.x; y = desktop_shm->cursor.y + input->mouse.y; } + if (x == desktop_shm->cursor.x && y == desktop_shm->cursor.y) + flags &= ~MOUSEEVENTF_MOVE; } else {
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=150929
Your paranoid android.
=== w11pro64 (32 bit report) ===
user32: input.c:4412: Test failed: layered 1: button_down_hwnd_todo 0: got MSG_TEST_WIN hwnd 000F0076, msg WM_LBUTTONDOWN, wparam 0x1, lparam 0x320032 input.c:4412: Test failed: layered 1: button_down_hwnd_todo 1 (missing): MSG_TEST_WIN hwnd 000F0076, WM_LBUTTONDOWN, wparam 0x1, lparam 0x320032 input.c:4418: Test failed: layered 6: button_up_hwnd_todo 0: got MSG_TEST_WIN hwnd 00140076, msg WM_LBUTTONUP, wparam 0, lparam 0x320032 input.c:4418: Test failed: layered 6: button_up_hwnd_todo 1 (missing): MSG_TEST_WIN hwnd 00140076, WM_LBUTTONUP, wparam 0, lparam 0x320032
=== w1064v1507 (32 bit report) ===
user32: win.c:13275: Test failed: window is minimized.
=== debian11 (32 bit ar:MA report) ===
user32: input.c:4306: Test succeeded inside todo block: button_down_hwnd_todo 1: got MSG_TEST_WIN hwnd 000400A8, msg WM_LBUTTONDOWN, wparam 0x1, lparam 0x320032
=== debian11 (32 bit de report) ===
user32: input.c:4306: Test succeeded inside todo block: button_down_hwnd_todo 1: got MSG_TEST_WIN hwnd 000400A8, msg WM_LBUTTONDOWN, wparam 0x1, lparam 0x320032
=== debian11 (32 bit he:IL report) ===
user32: input.c:4306: Test succeeded inside todo block: button_down_hwnd_todo 1: got MSG_TEST_WIN hwnd 000400A0, msg WM_LBUTTONDOWN, wparam 0x1, lparam 0x320032
=== debian11 (32 bit ja:JP report) ===
user32: input.c:4306: Test succeeded inside todo block: button_down_hwnd_todo 1: got MSG_TEST_WIN hwnd 000400A0, msg WM_LBUTTONDOWN, wparam 0x1, lparam 0x320032 input.c:733: Test failed: peek: raw_legacy: 0: test->expect 0 (missing): got WM_INPUT key hwnd 00000000, code 0, make_code 0x1, flags 0, vkey F, message WM_KEYDOWN, extra 0 input.c:733: Test failed: peek: raw_legacy: 0: test->expect 1 (missing): MSG_TEST_WIN hwnd 00000000, WM_KEYDOWN, wparam 0x46, lparam 0x10001 input.c:733: Test failed: peek: raw_legacy: 0: test->expect 2 (missing): MSG_TEST_WIN hwnd 00000000, WM_CHAR, wparam 0x66, lparam 0x10001 input.c:734: Test failed: peek: raw_legacy: 0: got F: 0 input.c:733: Test failed: peek: raw_legacy: 1: test->expect 0 (missing): got WM_INPUT key hwnd 00000000, code 0, make_code 0x2, flags 0x1, vkey F, message WM_KEYUP, extra 0 input.c:733: Test failed: peek: raw_legacy: 1: test->expect 1 (missing): MSG_TEST_WIN hwnd 00000000, WM_KEYUP, wparam 0x46, lparam 0xc0020001 input.c:733: Test failed: peek: raw_vk_packet_legacy: 0: test->expect 0 (missing): got WM_INPUT key hwnd 00000000, code 0, make_code 0x1, flags 0, vkey 0xe7, message WM_KEYDOWN, extra 0 input.c:733: Test failed: peek: raw_vk_packet_legacy: 0: test->expect 1 (missing): MSG_TEST_WIN hwnd 00000000, WM_KEYDOWN, wparam 0xe7, lparam 0x10001 input.c:734: Test failed: peek: raw_vk_packet_legacy: 0: got 0xe7: 0 input.c:733: Test failed: peek: raw_vk_packet_legacy: 1: test->expect 0 (missing): got WM_INPUT key hwnd 00000000, code 0, make_code 0x2, flags 0x1, vkey 0xe7, message WM_KEYUP, extra 0 input.c:733: Test failed: peek: raw_vk_packet_legacy: 1: test->expect 1 (missing): MSG_TEST_WIN hwnd 00000000, WM_KEYUP, wparam 0xe7, lparam 0xc0020001 input.c:733: Test failed: peek: raw_unicode_legacy: 0: test->expect 1 (missing): MSG_TEST_WIN hwnd 00000000, WM_CHAR, wparam 0x3c0, lparam 0x1 input.c:734: Test failed: peek: raw_unicode_legacy: 0: got 0xe7: 0 input.c:733: Test failed: peek: raw_unicode_vkey_ctrl_legacy: 0: test->expect 0 (missing): MSG_TEST_WIN hwnd 00000000, WM_KEYDOWN, wparam 0x11, lparam 0xc00001 input.c:734: Test failed: peek: raw_unicode_vkey_ctrl_legacy: 0: got VK_CONTROL: 0 input.c:734: Test failed: peek: raw_unicode_vkey_ctrl_legacy: 0: got VK_LCONTROL: 0 input.c:733: Test failed: peek: raw_unicode_vkey_ctrl_legacy: 1: test->expect 0 (missing): MSG_TEST_WIN hwnd 00000000, WM_KEYUP, wparam 0x11, lparam 0xc0c00001 input.c:733: Test failed: peek: raw_nolegacy: 0: test->expect 0 (missing): got WM_INPUT key hwnd 00000000, code 0, make_code 0x1, flags 0, vkey F, message WM_KEYDOWN, extra 0 input.c:733: Test failed: peek: raw_nolegacy: 1: test->expect 0 (missing): got WM_INPUT key hwnd 00000000, code 0, make_code 0x2, flags 0x1, vkey F, message WM_KEYUP, extra 0 input.c:733: Test failed: peek: raw_vk_packet_nolegacy: 0: test->expect 0 (missing): got WM_INPUT key hwnd 00000000, code 0, make_code 0x1, flags 0, vkey 0xe7, message WM_KEYDOWN, extra 0 input.c:733: Test failed: peek: raw_vk_packet_nolegacy: 1: test->expect 0 (missing): got WM_INPUT key hwnd 00000000, code 0, make_code 0x2, flags 0x1, vkey 0xe7, message WM_KEYUP, extra 0 input.c:733: Test failed: receive: raw_legacy: 0: test->expect 0 (missing): got WM_INPUT key hwnd 00000000, code 0, make_code 0x1, flags 0, vkey F, message WM_KEYDOWN, extra 0 input.c:733: Test failed: receive: raw_legacy: 0: test->expect 1 (missing): MSG_TEST_WIN hwnd 00000000, WM_KEYDOWN, wparam 0x46, lparam 0x10001 input.c:733: Test failed: receive: raw_legacy: 0: test->expect 2 (missing): MSG_TEST_WIN hwnd 00000000, WM_CHAR, wparam 0x66, lparam 0x10001 input.c:734: Test failed: receive: raw_legacy: 0: got F: 0 input.c:733: Test failed: receive: raw_legacy: 1: test->expect 0 (missing): got WM_INPUT key hwnd 00000000, code 0, make_code 0x2, flags 0x1, vkey F, message WM_KEYUP, extra 0 input.c:733: Test failed: receive: raw_legacy: 1: test->expect 1 (missing): MSG_TEST_WIN hwnd 00000000, WM_KEYUP, wparam 0x46, lparam 0xc0020001 input.c:733: Test failed: receive: raw_vk_packet_legacy: 0: test->expect 0 (missing): got WM_INPUT key hwnd 00000000, code 0, make_code 0x1, flags 0, vkey 0xe7, message WM_KEYDOWN, extra 0 input.c:733: Test failed: receive: raw_vk_packet_legacy: 0: test->expect 1 (missing): MSG_TEST_WIN hwnd 00000000, WM_KEYDOWN, wparam 0xe7, lparam 0x10001 input.c:734: Test failed: receive: raw_vk_packet_legacy: 0: got 0xe7: 0 input.c:733: Test failed: receive: raw_vk_packet_legacy: 1: test->expect 0 (missing): got WM_INPUT key hwnd 00000000, code 0, make_code 0x2, flags 0x1, vkey 0xe7, message WM_KEYUP, extra 0 input.c:733: Test failed: receive: raw_vk_packet_legacy: 1: test->expect 1 (missing): MSG_TEST_WIN hwnd 00000000, WM_KEYUP, wparam 0xe7, lparam 0xc0020001 input.c:733: Test failed: receive: raw_unicode_legacy: 0: test->expect 1 (missing): MSG_TEST_WIN hwnd 00000000, WM_CHAR, wparam 0x3c0, lparam 0x1 input.c:734: Test failed: receive: raw_unicode_legacy: 0: got 0xe7: 0 input.c:733: Test failed: receive: raw_unicode_vkey_ctrl_legacy: 0: test->expect 0 (missing): MSG_TEST_WIN hwnd 00000000, WM_KEYDOWN, wparam 0x11, lparam 0xc00001 input.c:734: Test failed: receive: raw_unicode_vkey_ctrl_legacy: 0: got VK_CONTROL: 0 input.c:734: Test failed: receive: raw_unicode_vkey_ctrl_legacy: 0: got VK_LCONTROL: 0 input.c:733: Test failed: receive: raw_unicode_vkey_ctrl_legacy: 1: test->expect 0 (missing): MSG_TEST_WIN hwnd 00000000, WM_KEYUP, wparam 0x11, lparam 0xc0c00001 input.c:733: Test failed: receive: raw_nolegacy: 0: test->expect 0 (missing): got WM_INPUT key hwnd 00000000, code 0, make_code 0x1, flags 0, vkey F, message WM_KEYDOWN, extra 0 input.c:733: Test failed: receive: raw_nolegacy: 1: test->expect 0 (missing): got WM_INPUT key hwnd 00000000, code 0, make_code 0x2, flags 0x1, vkey F, message WM_KEYUP, extra 0 input.c:733: Test failed: receive: raw_vk_packet_nolegacy: 0: test->expect 0 (missing): got WM_INPUT key hwnd 00000000, code 0, make_code 0x1, flags 0, vkey 0xe7, message WM_KEYDOWN, extra 0 input.c:733: Test failed: receive: raw_vk_packet_nolegacy: 1: test->expect 0 (missing): got WM_INPUT key hwnd 00000000, code 0, make_code 0x2, flags 0x1, vkey 0xe7, message WM_KEYUP, extra 0
=== debian11 (32 bit zh:CN report) ===
user32: input.c:4306: Test succeeded inside todo block: button_down_hwnd_todo 1: got MSG_TEST_WIN hwnd 000400A0, msg WM_LBUTTONDOWN, wparam 0x1, lparam 0x320032
=== debian11b (32 bit WoW report) ===
user32: input.c:4306: Test succeeded inside todo block: button_down_hwnd_todo 1: got MSG_TEST_WIN hwnd 000400A0, msg WM_LBUTTONDOWN, wparam 0x1, lparam 0x320032 win.c:4070: Test failed: Expected active window 00B400C0, got 00000000. win.c:4071: Test failed: Expected focus window 00B400C0, got 00000000.
=== debian11b (64 bit WoW report) ===
kernel32: comm.c:1574: Test failed: AbortWaitCts hComPortEvent failed comm.c:1586: Test failed: Unexpected time 1000, expected around 500
user32: input.c:4306: Test succeeded inside todo block: button_down_hwnd_todo 1: got MSG_TEST_WIN hwnd 00000000052500F6, msg WM_LBUTTONDOWN, wparam 0x1, lparam 0x320032
v2: - add patch 1 (to fix otherwise missing mouse message when releasing capture).
Rémi Bernon (@rbernon) commented about dlls/user32/tests/input.c:
mouse_event( MOUSEEVENTF_MOVE, 0, 0, 0, 0 ); /* recent Windows versions don't call the hooks with no movement */
- ok(!current_sequence_len || broken(current_sequence_len) /* before Win10 1709 */, "got %ld.\n", current_sequence_len);
This kind of test seems rather pointless.
This merge request was approved by Rémi Bernon.
Approving as it looks okay and tests seem to pass, but it's also probably a bit late in the code freeze.
On Mon Jan 20 16:58:11 2025 +0000, Rémi Bernon wrote:
This kind of test seems rather pointless.
Well, true, but I wanted to document and unit-test Wine behaviour (while such a test is pointless on Windows it won't pass on Wine with old behaviour). Should I remove that test change?