From 3b95aad5059b6ea1caba1a5d6e3a1d7ef30ad06a Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Tue, 23 May 2006 18:58:00 +0900 Subject: [PATCH] user/tests: Don't generate a mouse click message in mouse_ll_global_thread_proc. Windows doesn't like when a thread plays games with the focus, that leads to all kinds of misbehaviours and failures to activate a window. So, better don't generate a mouse click message in mouse_ll_global_thread_proc. --- dlls/user/tests/msg.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/dlls/user/tests/msg.c b/dlls/user/tests/msg.c index 545844bc4bd..6ac2275eaf3 100644 --- a/dlls/user/tests/msg.c +++ b/dlls/user/tests/msg.c @@ -5584,7 +5584,7 @@ static DWORD cbt_hook_thread_id; static LRESULT CALLBACK cbt_hook_proc(int nCode, WPARAM wParam, LPARAM lParam) { - static const char *CBT_code_name[10] = { + static const char * const CBT_code_name[10] = { "HCBT_MOVESIZE", "HCBT_MINMAX", "HCBT_QS", @@ -6009,8 +6009,8 @@ static const struct message WmGlobalHookSeq_2[] = { static const struct message WmMouseLLHookSeq[] = { { WM_MOUSEMOVE, hook }, - { WM_LBUTTONDOWN, hook }, { WM_LBUTTONUP, hook }, + { WM_MOUSEMOVE, hook }, { 0 } }; @@ -6182,9 +6182,13 @@ static DWORD WINAPI mouse_ll_global_thread_proc(void *param) flush_sequence(); - mouse_event(MOUSEEVENTF_MOVE, 100, 0, 0, 0); - mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); + /* Windows doesn't like when a thread plays games with the focus, + * that leads to all kinds of misbehaviours and failures to activate + * a window. So, better don't generate a mouse click message below. + */ + mouse_event(MOUSEEVENTF_MOVE, -1, 0, 0, 0); mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); + mouse_event(MOUSEEVENTF_MOVE, 1, 0, 0, 0); SetEvent(hevent); while (GetMessage(&msg, 0, 0, 0)) @@ -6374,9 +6378,9 @@ static void test_winevents(void) ok_sequence(WmMouseLLHookSeq, "MOUSE_LL hook other thread", FALSE); flush_sequence(); - mouse_event(MOUSEEVENTF_MOVE, 0, 0, 0, 0); - mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); + mouse_event(MOUSEEVENTF_MOVE, -1, 0, 0, 0); mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); + mouse_event(MOUSEEVENTF_MOVE, 1, 0, 0, 0); ok_sequence(WmMouseLLHookSeq, "MOUSE_LL hook same thread", FALSE); @@ -7477,9 +7481,12 @@ START_TEST(msg) /* Fix message sequences before removing 4 lines below */ #if 1 - ret = pUnhookWinEvent(hEvent_hook); - ok( ret, "UnhookWinEvent error %ld\n", GetLastError()); - pUnhookWinEvent = 0; + if (pUnhookWinEvent && hEvent_hook) + { + ret = pUnhookWinEvent(hEvent_hook); + ok( ret, "UnhookWinEvent error %ld\n", GetLastError()); + pUnhookWinEvent = 0; + } hEvent_hook = 0; #endif -- 2.11.4.GIT