After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 105665 - Show desktop button does not update the workspace switcher
Show desktop button does not update the workspace switcher
Status: RESOLVED FIXED
Product: metacity
Classification: Other
Component: general
2.8.x
Other Linux
: High minor
: future
Assigned To: Metacity maintainers list
Metacity maintainers list
: 139445 142200 162010 (view as bug list)
Depends on:
Blocks: 155453
 
 
Reported: 2003-02-09 18:09 UTC by Patrick Pletscher
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: 2.7/2.8


Attachments
Set hidden state for windows if we're in the showing desktop state (625 bytes, patch)
2004-08-08 03:59 UTC, Elijah Newren
needs-work Details | Review
Updated patch (660 bytes, patch)
2004-10-17 04:42 UTC, Elijah Newren
needs-work Details | Review
Handle the needed cases from window_should_be_showing() (6.19 KB, patch)
2004-10-19 05:11 UTC, Elijah Newren
accepted-commit_now Details | Review

Description Patrick Pletscher 2003-02-09 18:09:01 UTC
Description of Problem:
If I click on the show desktop button the windows
are minimized, but the can still be seen in the
workspace switcher.

Steps to reproduce the problem:
1. Open a window, e.g. gnome-terminal
2. Make sure that the Workspace-Switcher applet is
on the panel.
3. Click on the show desktop button

Actual Results:
You can still see the windows in the Workspace
Switcher

Expected Results:
There should be no windows in the Workspace switcher

How often does this happen? 
always

Additional Information:
Comment 1 Vincent Untz 2003-02-11 21:14:58 UTC
Havoc: I'd say it's a bug in libwnck. There should be a callback for
showing_desktop_changed somewhere or something like that...
Comment 2 Havoc Pennington 2003-02-11 21:50:19 UTC
it may really be a metacity bug for not setting STATE_HIDDEN on 
windows when showing desktop. will need some tracking down.
Comment 3 Vincent Untz 2003-10-13 09:08:17 UTC
I've looked at the code in metacity (meta_screen_show_desktop). And,
as far as I can understand the code, it looks to me Havoc is right
about the STATE_HIDDEN stuff. So moving to metacity.
Comment 4 Elijah Newren 2004-08-07 17:54:00 UTC
*** Bug 142200 has been marked as a duplicate of this bug. ***
Comment 5 Elijah Newren 2004-08-07 17:54:32 UTC
*** Bug 139445 has been marked as a duplicate of this bug. ***
Comment 6 Elijah Newren 2004-08-08 03:59:39 UTC
Created attachment 30318 [details] [review]
Set hidden state for windows if we're in the showing desktop state

Here's a patch that almost does the trick.  When we enter showing desktop
state, not all windows are queued for update, and thus only the windows in the
current desktop actually get the net_wm_state_hidden property set.

However, bug 142198 aims to make "show desktop" be a per-desktop quantity
anyway, so I don't want to bother further until that patch is committed (or
rejected).  Note that due to bug 142198, we will have to replace
window->screen->showing_desktop with
meta_screen_showing_desktop_on_current_workspace (window->screen) in this
patch.
Comment 7 Elijah Newren 2004-08-08 04:02:52 UTC
Oops, crap.  That was an old version of the patch where I had reversed logic. 
It is kinda fun to see the workspace applet empty unless you're in show desktop
mode, though.  But to get it right, remove the exclamation mark.
Comment 8 Elijah Newren 2004-10-17 04:42:55 UTC
Created attachment 32683 [details] [review]
Updated patch

Here's a patch that takes into account the changes in bug 142198, and fixes the
logic reversal bug I pointed out in my last patch.
Comment 9 Havoc Pennington 2004-10-18 03:34:20 UTC
Comment on attachment 32683 [details] [review]
Updated patch

I think this will set HIDDEN on panels and desktop... probably need something
like "if this window would be hidden due to showing desktop, and we are showing
desktop"

Unfortunately I think this check is a bit complex, see
window_should_be_showing(), where it matters if the window is a transient of
the desktop or dock
Comment 10 Elijah Newren 2004-10-19 05:11:02 UTC
Created attachment 32753 [details] [review]
Handle the needed cases from window_should_be_showing()

Lots of comments on this patch:

The patch in bug 142198 accidentally introduced a bug as part of an attempt to
optimize.  This basically means that under certain circumstances, sticky
windows will not show/hide appropriately when showing or unshowing the desktop.
 This patch reverts the few relevant lines from screen.c to fix this problem
(and adds a comment to help explain why the old method is necessary).

I split window_should_be_showing() into two by adding the function
window_showing_on_its_workspace(), which contains the portion of
window_should_be_showing() relevant to determining HIDDEN state. 
(window_should_be_showing() then just ANDs the boolean check it does with the
return value of window_showing_on_its_workspace()).  This should keep things in
sync better and, as a bonus, it simultaneously solves bug 144745.

Unfortunately, this patch actually doesn't quite solve this bug.  There's still
a small corner case (those who use sticky windows and use "showing desktop" and
move around between desktops when some workspaces are in the showing desktop
state and others aren't) which affects the pager display of sticky windows. 
This corner case exists because we have conflicting requirements:
  - windows are allowed to be on more than one workspace
  - "showing desktop" is now a per-workspace quantity instead of a global one
  - _NET_WM_STATE_HIDDEN is still a global quantity, not a per-workspace one
This basically means that we can't get "sticky" windows to work correctly with
showing the desktop for the pager (although the version I have makes the bugs
hard to discover).  I can see three solutions (though perhaps there are more):

  1) Don't allow windows to be on more than one workspace--obviously, sticky
     windows are stupid  ;-)
  2) Introduce a new state into the EWMH that replaces _NET_WM_STATE_HIDDEN
     and has the same general meaning but which is a per-workspace quantity.
  3) Implement the requested feature of having sticky windows "follow the
     user", meaning that they only appear in the pager for the current
     workspace.  This has been discussed from a usability perspective in bug
     87531.

For both solutions 1 and 3, we should probably ensure that a window's
window->workspaces list contain no more than one item.	I believe that's
currently true for Metacity, but we definitely don't enforce it.  It would be
nice to replace the GList window->workspaces with a MetaWorkspace*
window->workspace.

Personally, I think (3) makes the most sense.  I think Michael argues
convincingly enough for it (in bug 87531), we avoid sticky windows for the most
part so this change will only affect a niche anyway, and that niche group seems
to be requesting this feature occasionally anyway (I remember seeing a few
other requests for this behavior).  If we really decide we don't like it, we
could revert and then do (2).

Thoughts? Comments? Other solutions?
Comment 11 Havoc Pennington 2004-10-22 20:03:37 UTC
I agree with approach #3.

window->workspaces having multiple items was just designing for flexibility.
It's been that way since the very first draft of metacity iirc. I think changing
this should be filed/discussed as a separate bug though.
Comment 12 Havoc Pennington 2004-10-22 20:06:49 UTC
Comment on attachment 32753 [details] [review]
Handle the needed cases from window_should_be_showing()

This looks basically reasonable to me, I would say HEAD only due to risk?

I have some sense we might be recalculating whether a window is showing lots of
times, but until it shows up in a profile we can probably ignore it.
Comment 13 Elijah Newren 2004-10-22 20:30:29 UTC
Committed to head, but the portion that reverts part of the ill-advised
optimization made by the patch in bug 142198 still needs to be committed to the
stable branch.  But, I'll reopen 142198 and post the patch there.  I'll also
open another bug as you suggest about having one window per workspace.
Comment 14 Elijah Newren 2004-12-22 19:55:40 UTC
*** Bug 162010 has been marked as a duplicate of this bug. ***