https://bugs.winehq.org/show_bug.cgi?id=48121
--- Comment #15 from RĂ©mi Bernon rbernon@codeweavers.com --- Sure, maybe HTMENU wasn't the best choice. I don't really know how that works and if there would be a better, safe, choice.
As for the other part, we only have 3 other choices:
- wontfix (sounds like you're leaning towards this?)
Not at all, just that the issue has complex implications (which I don't even know the extend of) and it doesn't seems easy to fix.
Plus Wine focus already doesn't match the X11 state in some cases. It's usually quite harmless, but it's something that goes beyond this particular issue and that could also make it worse.
- simulate alt-tab instead (my suggestion)
- just add some random hack that makes unity work and hopefully doenst break other stuff (pretty much David's poc, with maybe a little bit more throught put into which message we should fake)
I think a good fix would be to determine precisely where this is used and implement a better solution for each case. If I understand correctly there at least these cases that may be covered by this code and that could be improved:
1) Windows that cannot be activated through alt-tab on windows. We can probably use EMWH atoms to make the window ignore alt-tab in that case. There's some _NET_WM_STATE atoms (_NET_WM_STATE_SKIP_TASKBAR or _NET_WM_STATE_SKIP_PAGE) that should match that, assuming the WM implements it. We should of course query its capabilities first, and provide a fallback path.
2) Transparent click-through windows. I don't know if that's ever been considered already, of if it would even work, but I believe X11 has some ways to make windows transparent and click-through using the XShape extension. Maybe implementing it using it would be better, or maybe it's just not feasible if we don't have the geometry of the window and only hittest at our disposal.
3) As a fallback, possibly try to determine more precisely the source of the focus change, checking cursor position and button state maybe, to simulate the click when appropriate, and alt-tab when not. It's probably going to be hard, as X11 doesn't provide any information, sadly.