dinput/tests: Peek messages for the target window only.

This fixes "keyboard.c:365: Tests skipped: failed to queue keyboard event"
message on my Win10 PC (real hardware).
Since some thread messages and window messages, including IME related,
are observed on the thread, they sometimes confuse the message handler.

Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Akihiro Sagawa 2018-08-17 17:14:56 +09:00 committed by Alexandre Julliard
parent 8001dda117
commit b735a42f1c
1 changed files with 2 additions and 8 deletions

View File

@ -374,18 +374,12 @@ static void test_dik_codes(IDirectInputA *dI, HWND hwnd, LANGID langid)
n = SendInput(1, &in, sizeof(in)); n = SendInput(1, &in, sizeof(in));
ok(n == 1, "got %u\n", n); ok(n == 1, "got %u\n", n);
if (!PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) if (!PeekMessageA(&msg, hwnd, 0, 0, PM_REMOVE))
{
win_skip("failed to queue keyboard event\n");
break;
}
ok(msg.message == WM_KEYDOWN || broken(msg.message != WM_KEYDOWN), "expected WM_KEYDOWN, got %04x\n", msg.message);
/* this never happens on real hardware but tesbot VMs seem to have timing issues */
if (msg.message != WM_KEYDOWN)
{ {
win_skip("failed to queue keyboard event\n"); win_skip("failed to queue keyboard event\n");
break; break;
} }
ok(msg.message == WM_KEYDOWN, "expected WM_KEYDOWN, got %04x\n", msg.message);
DispatchMessageA(&msg); DispatchMessageA(&msg);
trace("keydown wParam: %#lx (%c) lParam: %#lx, MapVirtualKey(MAPVK_VK_TO_CHAR) = %c\n", trace("keydown wParam: %#lx (%c) lParam: %#lx, MapVirtualKey(MAPVK_VK_TO_CHAR) = %c\n",