Commit 6d77251c authored by Elijah Newren's avatar Elijah Newren Committed by Elijah Newren
Browse files

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
parent ccd4414a
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
......
......@@ -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
......
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment