linuxmint / muffin

The window management library for the Cinnamon desktop (libmuffin) and its sample WM binary (muffin)
GNU General Public License v2.0
197 stars 93 forks source link

Cannot tab out of Wine fullscreen applications (XIconifyWindow without MWM_FUNC_MINIMIZE) #169

Open stefand opened 9 years ago

stefand commented 9 years ago

Sine version 1.7.32 Wine handles focus loss events (usually Alt-Tab) for fullscreen Direct3D applications. The core part of this is minimizing the game's window and restoring the screen resolution to what it was before the game started. Minimizing the game's window does not work for most of the games because Muffin (just like any other Metacity fork) ignores XIconifyWindow requests on windows that do not set MWM_FUNC_MINIMIZE.

The user-visible symptom is a frozen window that does not redraw, cannot be completely minimized and cannot be restored either. For practical purposes the application the application crashes as soon as Alt-Tab is pressed. Interestingly the "Show Desktop" functionality can be used to minimize the window if the button is accessible with the frozen window on top of everything. After this the window can be restored by clicking on it in the panel and it resumes operation.

KDE, FVWM and xfwm minimize the window without issue. According to my investigations the current behavior of Wine matches that of Windows - applications without WS_MINIMIZEBOX do not have a Minimize item in their system menu, so not setting MWM_FUNC_MINIMIZE without WS_MINIMIZEBOX is the correct thing to do. Unfortunately the Motif Window Manager spec is very vague and says that window managers can do whatever they want with XIconifyWindow. The check in question was added to Metacity in 2001 by patch ec4dfd0c (git://git.gnome.org/metacity). It appears that this was a workaround against accidentally minimizing the gnome panel.

Unfortunately github does not allow me to attach any files other than pictures. I have uploaded an example Windows program that can be run with Wine here:

https://stefandoesinger.ddns.net/~stefan/minimize.c https://stefandoesinger.ddns.net/~stefan/minimize.exe (Self-signed SSL cert, and the server may be down every now and then)

The program simply fills the screen with a red color, fading to yellow, going back to red. On Alt-Tab the game should minimize. When going back to the application it should resume drawing its color. Ctrl+C it to quit.

Otherwise pretty much any Windows game can be used to reproduce the issue with Wine 1.7.32 or later. I have tested Half Life 2, Warcraft 3 and World in Conflict.

mtwebster commented 9 years ago

Hmm trying to test #170 - with Mint 17 I'm only running wine 1.6.2 and it seems not to work - it doesn't really even seem to be accepting keystrokes at all - I end up having to kill the wineserver process via tty. Alt-tab brings up the switcher (curiously, I have to do alt-tab-tab to make it appear), but this window remains on top of everything else, rendering things unusable.

I'll see if I can install 1.7.32+ to test (though I admit I'm a wine noob), but I'm curious if you know much about its behavior in 1.6.2?

stefand commented 9 years ago

Wine 1.6.2 doesn't implement any focus loss handling in d3d apps. The behavior you see is not entirely unexpected, although I'd expect that a blind alt-tab, followed by a ctrl+c (assuming the terminal receives focus) works, even though no immediate reaction to the alt-tab can be seen. Depends on the WM behavior a bit I guess.

A developer of Marco suggested a slightly different approach than my patch: Limit minimization without MWM_FUNC_MINIMIZE to fullscreen windows only.

stefand commented 9 years ago

Just to clarify: You won't be able to test #170 with Wine 1.6.2. It never attempts to do the minimization that fails.

talon commented 8 years ago

I have this same problem but in a different application did you happen to find a solution?

icarter09 commented 4 years ago

@talon was a solution ever found for this issue?