https://bugs.winehq.org/show_bug.cgi?id=42570
Zebediah Figura z.figura12@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Fixed by SHA1| |51895145fd67d3dd055888caaba | |7af413e4753f6 Resolution|--- |FIXED
--- Comment #2 from Zebediah Figura z.figura12@gmail.com --- Fixed by 51895145fd67d3dd055888caaba7af413e4753f6.
I'm going to copy the patch comment here for posterity:
--- 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.