diff options
author | Elijah Newren <newren@math.utah.edu> | 2004-10-22 20:28:36 +0000 |
---|---|---|
committer | Elijah Newren <newren@src.gnome.org> | 2004-10-22 20:28:36 +0000 |
commit | 6d77251c717e0ac8382721091a04653195344257 (patch) | |
tree | 5a3d4e4bd9a9a05c5966698e5b0a237dac17534e | |
parent | ccd4414a0f8891bad8fd56a819855d96bde403a1 (diff) | |
download | metacity-6d77251c717e0ac8382721091a04653195344257.tar.gz |
Update _NET_WM_STATE_HIDDEN so the pager on the panel will know whether to
2004-10-22 Elijah Newren <newren@math.utah.edu>
Update _NET_WM_STATE_HIDDEN so the pager on the panel will know
whether to display windows as visible or hidden (#105665)
* src/screen.c (queue_windows_showing): Revert the
queue_windows_showing portion of the patch committed on 2004-10-16
for #142198--it was an ill-advised optimization.
* src/window.c (window_showing_on_its_workspace,
window_should_be_showing): split the old window_should_be_showing
into these two functions, (set_net_wm_state): hidden state is more
complex; use window_showing_on_its_workspace to determine the
correct value
-rw-r--r-- | ChangeLog | 15 | ||||
-rw-r--r-- | src/screen.c | 12 | ||||
-rw-r--r-- | src/window.c | 89 |
3 files changed, 83 insertions, 33 deletions
@@ -1,3 +1,18 @@ +2004-10-22 Elijah Newren <newren@math.utah.edu> + + Update _NET_WM_STATE_HIDDEN so the pager on the panel will know + whether to display windows as visible or hidden (#105665) + + * src/screen.c (queue_windows_showing): Revert the + queue_windows_showing portion of the patch committed on 2004-10-16 + for #142198--it was an ill-advised optimization. + + * src/window.c (window_showing_on_its_workspace, + window_should_be_showing): split the old window_should_be_showing + into these two functions, (set_net_wm_state): hidden state is more + complex; use window_showing_on_its_workspace to determine the + correct value + 2004-10-20 Elijah Newren <newren@math.utah.edu> Patch from Soeren to fix the modifier key breakage introduced by diff --git a/src/screen.c b/src/screen.c index be1944b0..9cb462d1 100644 --- a/src/screen.c +++ b/src/screen.c @@ -2182,10 +2182,14 @@ meta_screen_update_showing_desktop_hint (MetaScreen *screen) static void queue_windows_showing (MetaScreen *screen) { - GList *windows; - GList *tmp; + GSList *windows; + GSList *tmp; - windows = screen->active_workspace->windows; + /* Must operate on all windows on display instead of just on the + * active_workspace's window list, because the active_workspace's + * window list may not contain the on_all_workspace windows. + */ + windows = meta_display_list_windows (screen->display); tmp = windows; while (tmp != NULL) @@ -2197,6 +2201,8 @@ queue_windows_showing (MetaScreen *screen) tmp = tmp->next; } + + g_slist_free (windows); } void diff --git a/src/window.c b/src/window.c index 0c40bb23..7415e745 100644 --- a/src/window.c +++ b/src/window.c @@ -102,6 +102,9 @@ static void ensure_mru_position_after (MetaWindow *window, void meta_window_move_resize_now (MetaWindow *window); +static gboolean window_showing_on_its_workspace (MetaWindow *window); +static gboolean window_should_be_showing (MetaWindow *window); + /* FIXME we need an abstraction that covers all these queues. */ void meta_window_unqueue_calc_showing (MetaWindow *window); @@ -1161,7 +1164,7 @@ set_net_wm_state (MetaWindow *window) data[i] = window->display->atom_net_wm_state_fullscreen; ++i; } - if (window->shaded || window->minimized) + if (!window_showing_on_its_workspace (window)) { data[i] = window->display->atom_net_wm_state_hidden; ++i; @@ -1227,37 +1230,19 @@ ancestor_is_minimized (MetaWindow *window) } static gboolean -window_should_be_showing (MetaWindow *window) +window_showing_on_its_workspace (MetaWindow *window) { - gboolean showing, on_workspace; + gboolean showing; gboolean is_desktop_or_dock; + MetaWorkspace* workspace_of_window; - meta_verbose ("Should be showing for window %s\n", window->desc); - - /* 1. See if we're on the workspace */ - - on_workspace = meta_window_visible_on_workspace (window, - window->screen->active_workspace); + showing = TRUE; - showing = on_workspace; - - if (!on_workspace) - meta_verbose ("Window %s is not on workspace %d\n", - window->desc, - meta_workspace_index (window->screen->active_workspace)); - else - meta_verbose ("Window %s is on the active workspace %d\n", - window->desc, - meta_workspace_index (window->screen->active_workspace)); - - if (window->on_all_workspaces) - meta_verbose ("Window %s is on all workspaces\n", window->desc); - - /* 2. See if we're minimized */ + /* 1. See if we're minimized */ if (window->minimized) showing = FALSE; - /* 3. See if we're in "show desktop" mode */ + /* 2. See if we're in "show desktop" mode */ is_desktop_or_dock = FALSE; is_desktop_or_dock_foreach (window, &is_desktop_or_dock); @@ -1265,16 +1250,34 @@ window_should_be_showing (MetaWindow *window) meta_window_foreach_ancestor (window, is_desktop_or_dock_foreach, &is_desktop_or_dock); + if (window->on_all_workspaces) + /* Unless the behavior in bug 87531 is implemented, or else + * _NET_WM_STATE_HIDDEN can be made per-workspace instead of + * global, or else we get rid of on_all_workspaces windows + * altogether, then this will be just a hack that only sort of + * works. + */ + workspace_of_window = window->screen->active_workspace; + else if (window->workspaces) + /* This is sort of hacky too; would like to guarantee that + * window->workspaces only contains a single workspace. I believe + * that's currently true in Metacity, but it isn't guaranteed to + * remain true in the future. + */ + workspace_of_window = window->workspaces->data; + else /* This only seems to be needed for startup */ + workspace_of_window = NULL; + if (showing && - window->screen->active_workspace->showing_desktop && + workspace_of_window && workspace_of_window->showing_desktop && !is_desktop_or_dock) { - meta_verbose ("Window %s is on current workspace, but we're showing the desktop\n", + meta_verbose ("We're showing the desktop on the workspace(s) that window %s is on\n", window->desc); showing = FALSE; } - /* 4. See if an ancestor is minimized (note that + /* 3. See if an ancestor is minimized (note that * ancestor's "mapped" field may not be up to date * since it's being computed in this same idle queue) */ @@ -1286,16 +1289,42 @@ window_should_be_showing (MetaWindow *window) } #if 0 - /* 5. See if we're drawing wireframe + /* 4. See if we're drawing wireframe */ if (window->display->grab_window == window && window->display->grab_wireframe_active) showing = FALSE; #endif - + return showing; } +static gboolean +window_should_be_showing (MetaWindow *window) +{ + gboolean on_workspace; + + meta_verbose ("Should be showing for window %s\n", window->desc); + + /* See if we're on the workspace */ + on_workspace = meta_window_visible_on_workspace (window, + window->screen->active_workspace); + + if (!on_workspace) + meta_verbose ("Window %s is not on workspace %d\n", + window->desc, + meta_workspace_index (window->screen->active_workspace)); + else + meta_verbose ("Window %s is on the active workspace %d\n", + window->desc, + meta_workspace_index (window->screen->active_workspace)); + + if (window->on_all_workspaces) + meta_verbose ("Window %s is on all workspaces\n", window->desc); + + return on_workspace && window_showing_on_its_workspace (window); +} + static void implement_showing (MetaWindow *window, gboolean showing) |