This fixes an issue seen in Outlook 365 where the password prompt appears to lock up.
Technically this fixes a regression introduced in 25906eedd8679fdb474976563f4a05a92e11bbd6, but I think Outlook had other issues that would have masked this one at the time.
From: Brendan McGrath bmcgrath@codeweavers.com
--- dlls/user32/tests/input.c | 64 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+)
diff --git a/dlls/user32/tests/input.c b/dlls/user32/tests/input.c index f92b839f1cb..801e496b7fa 100644 --- a/dlls/user32/tests/input.c +++ b/dlls/user32/tests/input.c @@ -3836,6 +3836,18 @@ static LRESULT CALLBACK mouse_move_wndproc(HWND hwnd, UINT msg, WPARAM wparam, L return DefWindowProcW(hwnd, msg, wparam, lparam); }
+static HANDLE mouse_move_event; + +static LRESULT CALLBACK mouse_move_wndproc2(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) +{ + if (msg == WM_MOUSEMOVE || msg == WM_NCMOUSEMOVE) + { + SetEvent(mouse_move_event); + } + + return DefWindowProcW(hwnd, msg, wparam, lparam); +} + static void test_Input_mouse(void) { BOOL got_button_down, got_button_up; @@ -3846,6 +3858,8 @@ static void test_Input_mouse(void) POINT pt, pt_org; MSG msg; BOOL ret; + int timeout; + DWORD end_time;
SetLastError(0xdeadbeef); ret = GetCursorPos(NULL); @@ -4008,6 +4022,7 @@ static void test_Input_mouse(void) } SetEvent(thread_data.end_event); WaitForSingleObject(thread, INFINITE); + CloseHandle(thread); todo_wine ok(hittest_no > 50, "expected loop with WM_NCHITTEST messages\n"); ok(!got_button_down, "unexpected WM_LBUTTONDOWN message\n"); ok(!got_button_up, "unexpected WM_LBUTTONUP message\n"); @@ -4101,6 +4116,55 @@ static void test_Input_mouse(void) GetCursorPos(&pt); ok(pt.x == 200 && pt.y == 200, "GetCursorPos returned %ldx%ld, expected 200x200\n", pt.x, pt.y);
+ /* move mouse over two windows where thread input queues are attached */ + SetWindowLongPtrA(hwnd, GWLP_WNDPROC, (LONG_PTR)DefWindowProcW); + SetCursorPos(500, 500); + thread_data.start_event = CreateEventA(NULL, FALSE, FALSE, NULL); + ok(thread_data.start_event != NULL, "CreateEvent failed\n"); + thread_data.end_event = CreateEventA(NULL, FALSE, FALSE, NULL); + ok(thread_data.end_event != NULL, "CreateEvent failed\n"); + mouse_move_event = CreateEventA(NULL, TRUE, FALSE, NULL); + thread = CreateThread(NULL, 0, create_static_win, &thread_data, 0, &thread_id); + ok(thread != NULL, "CreateThread failed\n"); + WaitForSingleObject(thread_data.start_event, INFINITE); + SetWindowLongPtrA(thread_data.win, GWLP_WNDPROC, (LONG_PTR)mouse_move_wndproc2); + ok(AttachThreadInput(thread_id, GetCurrentThreadId(), TRUE), + "AttachThreadInput failed\n"); + SetWindowPos(hwnd, NULL, 200, 200, 0, 0, SWP_NOSIZE); + while (wait_for_message(&msg)) DispatchMessageA(&msg); + pt.x = pt.y = 50; + ClientToScreen(hwnd, &pt); + SetCursorPos(pt.x, pt.y); + + timeout = 5000; + end_time = GetTickCount() + timeout; + do + { + if(MsgWaitForMultipleObjects(1, &mouse_move_event, FALSE, timeout, QS_ALLINPUT) == WAIT_OBJECT_0) break; + if(PeekMessageA(&msg, NULL, 0, 0, PM_NOREMOVE)) { + if(!GetMessageA(&msg, NULL, 0, 0)) break; + DispatchMessageA(&msg); + + if(msg.message == WM_MOUSEMOVE || msg.message == WM_NCMOUSEMOVE) + { + pt.x = pt.y = 50; + ClientToScreen(thread_data.win, &pt); + SetCursorPos(pt.x, pt.y); + } + } + timeout = end_time - GetTickCount(); + }while(timeout > 0); + + todo_wine + ok(WaitForSingleObject(mouse_move_event, 0) == WAIT_OBJECT_0, "Timed out waiting for mouse move event\n"); + SetEvent(thread_data.end_event); + wait_for_event(thread, INFINITE); + DestroyWindow(thread_data.win); + CloseHandle(thread_data.start_event); + CloseHandle(thread_data.end_event); + CloseHandle(mouse_move_event); + CloseHandle(thread); + SetCursorPos(pt_org.x, pt_org.y); empty_message_queue(); DestroyWindow(hwnd);
From: Brendan McGrath bmcgrath@codeweavers.com
--- dlls/user32/tests/input.c | 1 - server/queue.c | 8 +++++++- 2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/dlls/user32/tests/input.c b/dlls/user32/tests/input.c index 801e496b7fa..990f345d1be 100644 --- a/dlls/user32/tests/input.c +++ b/dlls/user32/tests/input.c @@ -4155,7 +4155,6 @@ static void test_Input_mouse(void) timeout = end_time - GetTickCount(); }while(timeout > 0);
- todo_wine ok(WaitForSingleObject(mouse_move_event, 0) == WAIT_OBJECT_0, "Timed out waiting for mouse move event\n"); SetEvent(thread_data.end_event); wait_for_event(thread, INFINITE); diff --git a/server/queue.c b/server/queue.c index d3ca1172d91..fce386e711f 100644 --- a/server/queue.c +++ b/server/queue.c @@ -2193,6 +2193,11 @@ static int check_hw_message_filter( user_handle_t win, unsigned int msg_code, } }
+/* is this message an internal driver notification message */ +static inline BOOL is_internal_hardware_message( unsigned int message ) +{ + return (message >= WM_WINE_CLIPCURSOR && message <= WM_WINE_LAST_DRIVER_MSG); +}
/* find a hardware message for the given queue */ static int get_hardware_message( struct thread *thread, unsigned int hw_id, user_handle_t filter_win, @@ -2287,7 +2292,8 @@ static int get_hardware_message( struct thread *thread, unsigned int hw_id, user
data->hw_id = msg->unique_id; set_reply_data( msg->data, msg->data_size ); - if (get_hardware_msg_bit( msg->msg ) == QS_RAWINPUT && (flags & PM_REMOVE)) + if (get_hardware_msg_bit( msg->msg ) == QS_RAWINPUT && + ((flags & PM_REMOVE) || is_internal_hardware_message( msg->msg ))) release_hardware_message( current->queue, data->hw_id ); return 1; }
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=141419
Your paranoid android.
=== w7u_2qxl (32 bit report) ===
user32: input.c:4158: Test failed: Timed out waiting for mouse move event
=== w7u_adm (32 bit report) ===
user32: input.c:4158: Test failed: Timed out waiting for mouse move event
=== w7pro64 (64 bit report) ===
user32: input.c:4158: Test failed: Timed out waiting for mouse move event
=== w10pro64_zh_CN (64 bit report) ===
user32: input.c:3646: Test failed: 08040804 / f0201009: WaitForSingleObject returned 0x102 input.c:3669: Test failed: 08040804 / f0201009: got change_hkl 0000000000000000 input.c:3674: Test failed: 08040804 / f0201009: got tmp_layout FFFFFFFFF0201009