On Wed Jun 1 18:31:09 2022 +0000, Stefan Dösinger wrote:
Afaiu SetForegroundWindow can fail on Windows if the terminal that is running the tests wasn't the foreground window when the test was started. I.e. it is some sort of focus stealing prevention. In the d3d tests we have a few similar tests. Those are mostly motivated by Linux WMs refusing to give us focus, not so much on Windows. There is also the case of fvwm2 or other WMs with a focus-follows-mouse setting that will make SetForegroundWindow not do what you want it to do.
Sure, `SetForegroundWindow` doesn't necessarily succeeds on windows, but in the case of the tests and how they are run on windows, it is not supposed to fail.
If it fails it means the tests will fail anyway. There have been cases like this in testbot runs, for instance when there's an unexpected topmost window (for instance the firewall warning), and it should be fixed by fixing the environment, not by skipping tests.
On Linux there's some other issues, but they are mitigated by the `flush_events` calls which makes sure X11 events stabilize in the state we expect windows to be. It is not ideal, and Wine `user32` and `winex11` are still racy w.r.t focus and foreground, but that's something that also need to be fixed, not ignored.