From: Zhiyi Zhang zzhang@codeweavers.com
For example, attaching thread A and B twice but detach them only once, then these two threads should still be attached. --- dlls/user32/tests/input.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
diff --git a/dlls/user32/tests/input.c b/dlls/user32/tests/input.c index 9196e67c15b..47c26293dec 100644 --- a/dlls/user32/tests/input.c +++ b/dlls/user32/tests/input.c @@ -4516,7 +4516,9 @@ static LRESULT WINAPI MsgCheckProcA(HWND hwnd, UINT message, WPARAM wParam, LPAR if (message == WM_USER+1) { HWND hwnd = (HWND)lParam; + todo_wine_if(wParam) ok(GetFocus() == hwnd, "thread expected focus %p, got %p\n", hwnd, GetFocus()); + todo_wine_if(wParam) ok(GetActiveWindow() == hwnd, "thread expected active %p, got %p\n", hwnd, GetActiveWindow()); } return DefWindowProcA(hwnd, message, wParam, lParam); @@ -4662,6 +4664,27 @@ static void test_attach_input(void)
SendMessageA(wnd_event.hwnd, WM_USER+1, 0, 0);
+ /* Test repeated AttachThreadInput() calls */ + SetFocus(ourWnd); + SetActiveWindow(ourWnd); + + ret = AttachThreadInput(GetCurrentThreadId(), tid, TRUE); + ok(ret, "AttachThreadInput error %ld\n", GetLastError()); + SendMessageA(wnd_event.hwnd, WM_USER+1, 0, (LPARAM)ourWnd); + + ret = AttachThreadInput(GetCurrentThreadId(), tid, TRUE); + ok(ret, "AttachThreadInput error %ld\n", GetLastError()); + SendMessageA(wnd_event.hwnd, WM_USER+1, 0, (LPARAM)ourWnd); + + ret = AttachThreadInput(GetCurrentThreadId(), tid, FALSE); + ok(ret, "AttachThreadInput error %ld\n", GetLastError()); + SendMessageA(wnd_event.hwnd, WM_USER+1, TRUE, (LPARAM)ourWnd); + + ret = AttachThreadInput(GetCurrentThreadId(), tid, FALSE); + todo_wine + ok(ret, "AttachThreadInput error %ld\n", GetLastError()); + SendMessageA(wnd_event.hwnd, WM_USER+1, 0, 0); + ret = PostMessageA(wnd_event.hwnd, WM_QUIT, 0, 0); ok(ret, "PostMessageA(WM_QUIT) error %ld\n", GetLastError());