Hi,
after installing 0.9.42 I noticed some odd behavior when playing Diablo 2. I did a git bisect and nailed it down to this patch:
http://source.winehq.org/git/wine.git/?a=commit;h=d836a5062141dd42293ed044de...
winex11drv: Correctly react to focus loss away from Wine.
I noticed the following changes:
a) Using diablo 2's windowed mode: d2 will realize when it's losing focus again (as it did somewhere around 0.9.2x). As far as I can tell, this works reliable. (That's not a good thing for diablo 2, since d2 will minimize on losing focus and cannot be brought back to life afterwards. But that's a different bug.)
From now on, please read "Diablo 2 minimizes" as "Diablo 2 thinks it
lost focus".
b) Using d2 in fullscreen mode inside wine's virtual desktop: d2 will sometimes think it lost focus, even if it didn't. Moving the wine window around with hotkey+drag: d2 minimizes. Moving the window by the title bar: nothing happens. (using kde/kwin btw) Sometimes just clicking inside the window while playing will cause d2 to minimize, although I haven't found a reproducible pattern (i.e. do I have to press certain keys, do I have to double-click, etc).
Activating a different window outside the virtual desktop? d2 stays open. Or opening another application via hotkey, or pulling down yakuake via hotkey. It stays open. But, if I reactivate the virtual desktop window afterwards: d2 minimizes. Ouch.
c) virtual desktop again: when holding ALT to show the dropped items, then left clicking somewhere, d2 thinks that ALT has been released. This makes it quite hard to pick up items. This problem does not occur when using regular windowed mode or when changing the hotkey to something different - as far as I can tell only ALT in virtual desktop mode is affected. Note that I don't have any hotkeys on Alt (or Alt+click), I bound window dragging to the otherwised unused windows key.
While the patch does as intended on regular windows, it's effects on virtual desktop windows can only be described as weird.
I don't know how virtual desktops are supposed to work. At least for d2, it'd be useful if one application inside the virtual desktop always keeps focused (or rather, is told it'd still be focused). IMHO that's the purpose of virtual desktops: banning the apps inside a container where they shouldn't be influenced by outside stuff, including activating a different window. Not losing focus is also more sensible when virtual desktops are used as a way to ban fullscreen-apps into windows: most fullscreen applications don't expect to lose focus and behave weird.
However, even if you think of virtual desktops simply as a means to group windows, it's currently broken: losing focus on reactivation is a little late.
I have compiled the latest git version without this patch, and virtual desktop mode works fine again, so it's really down to this single line of code.
I'm not far enough into the code to know any possible solution, but for immediate results a simple
if (inside a virtual desktop) do old behaviour else do new behaviour
should do the trick until a better solution is found.
greetings, Christian