https://bugs.winehq.org/show_bug.cgi?id=51130
Rémi Bernon rbernon@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |rbernon@codeweavers.com Fixed by SHA1| |ebe3cea01d127de612171b6276c | |473a2b455266d Status|NEW |RESOLVED Resolution|--- |FIXED
--- Comment #4 from Rémi Bernon rbernon@codeweavers.com --- I think the problem was coming from SetActiveWindow(0) calls, which were done on various occasion, trying to de-activate the active window. The problem is that on older (< Win10), SetActiveWindow(0) succeeds but tries to give the foreground to another applications (or requests it back on the second call), possibly losing it.
I'm not completely sure if this was a bug or a feature, and I'm a bit surprised that you could get the foreground back as easily (although I haven't tried what an user action could change). But this has clearly been removed since Win10. The call now returns 0 (which should be understood as a failure I guess, although it doesn't change last error).
I added proper testing of this behavior, and removed the calls where they were done as it's a bit unpredictable. I believe the failure should not happen anymore after ebe3cea01d127de612171b6276c473a2b455266d (although there may still be GetActiveWindow failures elsewhere for other reasons).