Draft: winemac.drv: Some dock icon hiding improvements
The most important thing here is a workaround for an OS bug: rapidly hiding and showing the dock icon can result in multiple icons for the same app, and those icons will ignore NSApp.applicationIconImage. Making sure transitions happen no less than 1 second apart from one another seems to fix it. Edit: v2 update: 0.5 seconds is not always long enough. A good test case is the Notepad++ installer: after you select a language, it rapidly hides and shows some windows, and without a longer delay the icon will wind up with the default system terminal-looking icon. One second is probably overkill, but this ought to be a somewhat uncommon case.
Also, hiding a dock icon will deactivate an app. That's not desirable if it still has visible windows, so attempt to force a reactivation. That's often not successful on Sonoma due to the cooperative app activation heuristics, but it's the best we can do, and it should be a rare case.
Also, there is some logic in -transformProcessToForeground: that we often want to happen regardless of whether the app is getting a dock icon (e.g. App Nap and activation). So I've renamed that function to more accurately communicate what it does, and consolidate it with -tryToActivateIgnoringOtherApps:.