From: Zebediah Figura Subject: [PATCH v2 5/5] user32: Only process sent messages from driver in PeekMessage(). Message-Id: <1489762118-19901-5-git-send-email-z.figura12@gmail.com> Date: Fri, 17 Mar 2017 09:48:38 -0500 In-Reply-To: <1489762118-19901-1-git-send-email-z.figura12@gmail.com> References: <1489762118-19901-1-git-send-email-z.figura12@gmail.com> Currently calling PeekMessage() will process all pending driver events, causing e.g. the focus to change when one window has lost it. However, this does not match Windows behaviour. Signed-off-by: Zebediah Figura --- dlls/user32/message.c | 2 +- dlls/user32/tests/win.c | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/dlls/user32/message.c b/dlls/user32/message.c index 48d2a20..3c9662f 100644 --- a/dlls/user32/message.c +++ b/dlls/user32/message.c @@ -3864,7 +3864,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH PeekMessageW( MSG *msg_out, HWND hwnd, UINT first, DWORD ret; flush_window_surfaces( TRUE ); - ret = wow_handlers.wait_message( 0, NULL, 0, QS_ALLINPUT, 0 ); + ret = wow_handlers.wait_message( 0, NULL, 0, QS_SENDMESSAGE, 0 ); /* if we received driver events, check again for a pending message */ if (ret == WAIT_TIMEOUT || !peek_message( &msg, hwnd, first, last, flags, 0 )) return FALSE; } diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index 2562e81..3d9c546 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -3331,8 +3331,8 @@ static void test_SetForegroundWindow(HWND hwnd) while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg); if (0) check_wnd_state(hwnd2, hwnd2, hwnd2, 0); - todo_wine ok(GetActiveWindow() == hwnd2, "Expected active window %p, got %p.\n", hwnd2, GetActiveWindow()); - todo_wine ok(GetFocus() == hwnd2, "Expected focus window %p, got %p.\n", hwnd2, GetFocus()); + ok(GetActiveWindow() == hwnd2, "Expected active window %p, got %p.\n", hwnd2, GetActiveWindow()); + ok(GetFocus() == hwnd2, "Expected focus window %p, got %p.\n", hwnd2, GetFocus()); SetForegroundWindow(hwnd); check_wnd_state(hwnd, hwnd, hwnd, 0); @@ -6600,9 +6600,7 @@ static void test_EnableWindow(void) } ok(!IsWindowEnabled(hwnd), "window should not be enabled\n"); - todo_wine - check_active_state(hwnd, hwnd, hwnd); - ok(0 == GetCapture(), "GetCapture() = %p\n", GetCapture()); + check_wnd_state(hwnd, hwnd, hwnd, 0); CloseHandle(hthread); DestroyWindow(hwnd); -- 2.7.4