[PATCH 2/2] dinput/tests: Don't pump messages in test_acquire().
z.figura12 at gmail.com
Fri Nov 3 17:26:59 CDT 2017
This causes intermittent failures due to implementation of our window drivers.
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
The purpose of this test is to ensure that the DirectInput device is unacquired
when its associated window loses foreground status. Calling CreateWindow() is
enough to achieve this; pumping messages is unnecessary for the test and causes
an intermittent failure unrelated to DirectInput.
Specifically, due to the way our window managers are implemented (both X11 and
Mac), upon creating a second window we actually appear to send WM_MOUSEACTIVATE
messages twice, once for the window which will lose focus and once for the
window which will gain it. The latter message is not always sent before the
message pump completes, and so sometimes the simple sequence
hwnd = CreateWindow(...);
hwnd2 = CreateWindow(...);
while (PeekMessageA(...)) DispatchMessageA(&msg);
ret = GetForegroundWindow();
will return hwnd rather than hwnd2.
This never occurs on Windows. I do not know whether this is a bug in Wine or
X11/Quartz, or even if it is something that should be expected of Wine. If it
is, I will submit the above as a test to user32/msg.c, although I would welcome
any advice on how to render it a consistent rather than intermittent failure.
dlls/dinput/tests/mouse.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/dlls/dinput/tests/mouse.c b/dlls/dinput/tests/mouse.c
index a6c981c..455f136 100644
@@ -132,7 +132,6 @@ static void test_acquire(IDirectInputA *pDI, HWND hwnd)
hwnd2 = CreateWindowA("static", "Temporary", WS_VISIBLE, 10, 210, 200, 200, NULL, NULL, NULL,
ok(hwnd2 != NULL, "CreateWindowA failed with %u\n", GetLastError());
- while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
hr = IDirectInputDevice_GetDeviceState(pMouse, sizeof(m_state), &m_state);
ok(hr == DIERR_NOTACQUIRED, "GetDeviceState() should have failed: %08x\n", hr);
More information about the wine-patches