Problems with focus losing on virtual desktops

Jesse Allen the3dfxdude at gmail.com
Mon Aug 13 15:59:37 CDT 2007


On 8/13/07, Christian Authmann <spam at authmann.de> wrote:
> 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=d836a5062141dd42293ed044debbaf25f914f383
>
>   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.)


I don't have much to comment on this one other than if you can prove
that this is not a behavior in windows, then you should probably open
a bug report. But I do believe the windowed mode wasn't really how the
game was intended to be played, just how the "-opengl" switch does
nothing other than corrupt the games graphics (and doesn't even
utilize opengl). These were more likely used in development and left
in for archaic reasons (seeing that the game doesn't visibly advertise
either). It's entirely possible that the messaging handler reacts very
similarly to like when it's in a virtual desktop because the game was
designed to be full screen.

>
>
> >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.

This problem sounds like is caused by the design of the game. We can't fix this.



>
>
> 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.


This ALT key problem seems like the window manager is still
intercepting the ALT key somehow (even though certain keystrokes are
disabled). I'll test for this and tell you whether that's my
conclusion.

>
>
> 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.
>

I can't tell you if this will happen. But I can look at the game
again, and give my advice.



More information about the wine-devel mailing list