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

Alexandre Julliard julliard at winehq.org
Fri Aug 17 12:33:09 CDT 2018


Module: wine
Branch: master
Commit: b735a42f1cc440154e394ab5b74d394d018a5623
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=b735a42f1cc440154e394ab5b74d394d018a5623

Author: Akihiro Sagawa <sagawa.aki at gmail.com>
Date:   Fri Aug 17 17:14:56 2018 +0900

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 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dinput/tests/keyboard.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/dlls/dinput/tests/keyboard.c b/dlls/dinput/tests/keyboard.c
index 8b29089..151c691 100644
--- a/dlls/dinput/tests/keyboard.c
+++ b/dlls/dinput/tests/keyboard.c
@@ -374,18 +374,12 @@ static void test_dik_codes(IDirectInputA *dI, HWND hwnd, LANGID langid)
         n = SendInput(1, &in, sizeof(in));
         ok(n == 1, "got %u\n", n);
 
-        if (!PeekMessageA(&msg, 0, 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)
+        if (!PeekMessageA(&msg, hwnd, 0, 0, PM_REMOVE))
         {
             win_skip("failed to queue keyboard event\n");
             break;
         }
+        ok(msg.message == WM_KEYDOWN, "expected WM_KEYDOWN, got %04x\n", msg.message);
         DispatchMessageA(&msg);
 
         trace("keydown wParam: %#lx (%c) lParam: %#lx, MapVirtualKey(MAPVK_VK_TO_CHAR) = %c\n",




More information about the wine-cvs mailing list