https://bugs.winehq.org/show_bug.cgi?id=57569
--- Comment #5 from RĂ©mi Bernon rbernon@codeweavers.com --- Now, each case seem to be correct in isolation, and with the information at hand, the decision to make the desktop window foreground is perfectly valid.
I believe we could perhaps do something better if we can predict what events we're going to receive, similarly to what's been done for window configs. For instance, we know that mapping a window will cause a focus change, and we should also be able to tell that destroying a window will cause another focus change.
Of course we won't be able to always exactly predict the WM decision about which window will get focus, but in most case and if we're right about our predictions, we can ignore the no-op events and avoid touching the Win32 state unnecessarily.