Comment 9 for bug 91784

Revision history for this message
In , Michael Terry (mterry) wrote :

Created an attachment (id=18505)
Proposed patch

The _NET_SHOWING_DESKTOP property should be set to 0 when a window is shown, thereby indicating that compiz is no longer "showing the desktop".

This would match Metacity's behavior more closely and allow the standard GNOME "Show Desktop" panel applet to work correctly:

Metacity & "Show Desktop":
1) Open some windows
2) Press "Show Desktop", note how windows are hidden and button is depressed
3) Unminimize a window or open a new window, note how button is now popped back up (because Metacity set _NET_SHOWING_DESKTOP to 0)
4) Press "Show Desktop" again, note how only the new window is hidden again.

Compiz & "Show Desktop":
1) Open some windows
2) Press "Show Desktop", note how windows are hidden and button is depressed
3) Unminimize a window or open a new window, note how button does not change
4) Press "Show Desktop" again, note how it pops back up and unminimizes previously hidden windows. This is unexpected, since if I have windows obscuring the desktop and I press "Show Desktop", I want to see the desktop.

So, the fix seems easy enough. Whenever a window is shown in compiz, unset the _NET_SHOWING_DESKTOP (for some user-useful definition of window -- obviously not popup menus and the like).

I'm attaching a patch, but I know it isn't perfect, because I don't know compiz internals well. It basically adds two checkpoints for unsetting _NET_SHOWING_DESKTOP -- when showing a window and creating a window. I copied the logic for what kind of windows 'count' for unsetting the property from the logic deciding which windows to hide when "Show Desktop" is pressed (in screen.c:enterShowDesktopMode()). However, the 'managed' flag doesn't seem to be correctly set at create-window time? So I had to create a copy of focusWindow() that ignored it. I'm open to feedback. :)