Commit e84778d1 authored by Elijah Newren's avatar Elijah Newren Committed by Elijah Newren
Browse files

Make the "showing desktop" mode be per-workspace instead of per-screen.

2004-10-16  Elijah Newren  <newren@math.utah.edu>

	Make the "showing desktop" mode be per-workspace instead of
	per-screen. (fixes #142198)

	* src/keybindings.c (handle_toggle_desktop): access
	showing_desktop through the active workspace

	* src/screen.c (meta_screen_new): remove initialization of
	screen->showing_desktop,
	(meta_screen_update_showing_desktop_hint): rename and make not
	static and access showing_desktop through the active workspace,
	(queue_windows_showing): replace meta_display_list_windows() with
	screen->active_workspace->windows,
	(meta_screen_minimize_all_on_active_workspace_except): renamed
	from meta_screen_minimize_all_except since it now only works on
	the active workspace, (meta_screen_show_desktop,
	meta_screen_unshow_desktop): access showing_desktop through the
	active workspace

	* src/screen.h (struct _MetaScreen): remove showing_desktop field,
	(meta_screen_minimize_all_on_active_workspace_except): rename from
	meta_screen_minimize_all_except,
	(meta_screen_update)_showing_desktop_hint): export this function too

	* src/window.c (maybe_leave_show_desktop_mode): access
	showing_desktop through the active workspace and use new name for
	meta_screen_minimize_all_on_active_workspace_except,
	(window_should_be_showing): access showing_desktop through the
	active workspace

	* src/workspace.c (meta_workspace_new): initialize
	workspace->showing_desktop, (meta_workspace_activate_with_focus):
	add note that old can be NULL, update showing_desktop_hint if
	different on this workspace than the previous one

	* src/workspace.h (struct _MetaWorkspace): add showing_desktop
	field
parent e6fe4406
2004-10-16 Elijah Newren <newren@math.utah.edu>
Make the "showing desktop" mode be per-workspace instead of
per-screen. (fixes #142198)
* src/keybindings.c (handle_toggle_desktop): access
showing_desktop through the active workspace
* src/screen.c (meta_screen_new): remove initialization of
screen->showing_desktop,
(meta_screen_update_showing_desktop_hint): rename and make not
static and access showing_desktop through the active workspace,
(queue_windows_showing): replace meta_display_list_windows() with
screen->active_workspace->windows,
(meta_screen_minimize_all_on_active_workspace_except): renamed
from meta_screen_minimize_all_except since it now only works on
the active workspace, (meta_screen_show_desktop,
meta_screen_unshow_desktop): access showing_desktop through the
active workspace
* src/screen.h (struct _MetaScreen): remove showing_desktop field,
(meta_screen_minimize_all_on_active_workspace_except): rename from
meta_screen_minimize_all_except,
(meta_screen_update)_showing_desktop_hint): export this function too
* src/window.c (maybe_leave_show_desktop_mode): access
showing_desktop through the active workspace and use new name for
meta_screen_minimize_all_on_active_workspace_except,
(window_should_be_showing): access showing_desktop through the
active workspace
* src/workspace.c (meta_workspace_new): initialize
workspace->showing_desktop, (meta_workspace_activate_with_focus):
add note that old can be NULL, update showing_desktop_hint if
different on this workspace than the previous one
* src/workspace.h (struct _MetaWorkspace): add showing_desktop
field
2004-10-16 Elijah Newren <newren@math.utah.edu>
* rationales.txt: Add new tracker bugs
......
......@@ -2805,7 +2805,7 @@ handle_toggle_desktop (MetaDisplay *display,
XEvent *event,
MetaKeyBinding *binding)
{
if (screen->showing_desktop)
if (screen->active_workspace->showing_desktop)
{
meta_screen_unshow_desktop (screen);
meta_workspace_focus_default_window (screen->active_workspace,
......
......@@ -539,8 +539,6 @@ meta_screen_new (MetaDisplay *display,
screen->vertical_workspaces = FALSE;
screen->starting_corner = META_SCREEN_TOPLEFT;
screen->showing_desktop = FALSE;
screen->compositor_windows = NULL;
screen->damage_region = None;
screen->root_picture = None;
......@@ -2166,12 +2164,12 @@ meta_screen_resize (MetaScreen *screen,
meta_screen_foreach_window (screen, meta_screen_resize_func, 0);
}
static void
update_showing_desktop_hint (MetaScreen *screen)
void
meta_screen_update_showing_desktop_hint (MetaScreen *screen)
{
unsigned long data[1];
data[0] = screen->showing_desktop ? 1 : 0;
data[0] = screen->active_workspace->showing_desktop ? 1 : 0;
meta_error_trap_push (screen->display);
XChangeProperty (screen->display->xdisplay, screen->xroot,
......@@ -2184,10 +2182,10 @@ update_showing_desktop_hint (MetaScreen *screen)
static void
queue_windows_showing (MetaScreen *screen)
{
GSList *windows;
GSList *tmp;
GList *windows;
GList *tmp;
windows = meta_display_list_windows (screen->display);
windows = screen->active_workspace->windows;
tmp = windows;
while (tmp != NULL)
......@@ -2199,18 +2197,16 @@ queue_windows_showing (MetaScreen *screen)
tmp = tmp->next;
}
g_slist_free (windows);
}
void
meta_screen_minimize_all_except (MetaScreen *screen,
MetaWindow *keep)
meta_screen_minimize_all_on_active_workspace_except (MetaScreen *screen,
MetaWindow *keep)
{
GSList *windows;
GSList *tmp;
windows = meta_display_list_windows (screen->display);
GList *windows;
GList *tmp;
windows = screen->active_workspace->windows;
tmp = windows;
while (tmp != NULL)
......@@ -2224,36 +2220,35 @@ meta_screen_minimize_all_except (MetaScreen *screen,
tmp = tmp->next;
}
g_slist_free (windows);
}
void
meta_screen_show_desktop (MetaScreen *screen)
{
if (screen->showing_desktop)
if (screen->active_workspace->showing_desktop)
return;
screen->showing_desktop = TRUE;
screen->active_workspace->showing_desktop = TRUE;
queue_windows_showing (screen);
update_showing_desktop_hint (screen);
meta_screen_update_showing_desktop_hint (screen);
}
void
meta_screen_unshow_desktop (MetaScreen *screen)
{
if (!screen->showing_desktop)
if (!screen->active_workspace->showing_desktop)
return;
screen->showing_desktop = FALSE;
screen->active_workspace->showing_desktop = FALSE;
queue_windows_showing (screen);
update_showing_desktop_hint (screen);
meta_screen_update_showing_desktop_hint (screen);
}
#ifdef HAVE_STARTUP_NOTIFICATION
static gboolean startup_sequence_timeout (void *data);
......
......@@ -76,7 +76,7 @@ struct _MetaScreen
MetaWorkspace *active_workspace;
GList *workspaces;
MetaStack *stack;
MetaCursor current_cursor;
......@@ -108,7 +108,6 @@ struct _MetaScreen
guint keys_grabbed : 1;
guint all_keys_grabbed : 1;
guint showing_desktop : 1;
int closing;
......@@ -197,13 +196,16 @@ void meta_screen_resize (MetaScreen *screen,
int width,
int height);
void meta_screen_minimize_all_except (MetaScreen *screen,
MetaWindow *keep);
void meta_screen_minimize_all_on_active_workspace_except (MetaScreen *screen,
MetaWindow *keep);
/* Show/hide the desktop (temporarily hide all windows) */
void meta_screen_show_desktop (MetaScreen *screen);
void meta_screen_unshow_desktop (MetaScreen *screen);
/* Update whether the destkop is being shown for the current active_workspace */
void meta_screen_update_showing_desktop_hint (MetaScreen *screen);
void meta_screen_apply_startup_properties (MetaScreen *screen,
MetaWindow *window);
......
......@@ -158,7 +158,7 @@ maybe_leave_show_desktop_mode (MetaWindow *window)
{
gboolean is_desktop_or_dock;
if (!window->screen->showing_desktop)
if (!window->screen->active_workspace->showing_desktop)
return;
/* If the window is a transient for the dock or desktop, don't
......@@ -175,7 +175,8 @@ maybe_leave_show_desktop_mode (MetaWindow *window)
if (!is_desktop_or_dock)
{
meta_screen_minimize_all_except (window->screen, window);
meta_screen_minimize_all_on_active_workspace_except (window->screen,
window);
meta_screen_unshow_desktop (window->screen);
}
}
......@@ -1265,7 +1266,7 @@ window_should_be_showing (MetaWindow *window)
&is_desktop_or_dock);
if (showing &&
window->screen->showing_desktop &&
window->screen->active_workspace->showing_desktop &&
!is_desktop_or_dock)
{
meta_verbose ("Window %s is on current workspace, but we're showing the desktop\n",
......
......@@ -67,6 +67,8 @@ meta_workspace_new (MetaScreen *screen)
workspace->right_struts = NULL;
workspace->top_struts = NULL;
workspace->bottom_struts = NULL;
workspace->showing_desktop = FALSE;
return workspace;
}
......@@ -283,12 +285,20 @@ meta_workspace_activate_with_focus (MetaWorkspace *workspace,
if (workspace->screen->active_workspace == workspace)
return;
/* Note that old can be NULL; e.g. when starting up */
old = workspace->screen->active_workspace;
workspace->screen->active_workspace = workspace;
set_active_space_hint (workspace->screen);
/* If the "show desktop" mode is active for either the old workspace
* or the new one *but not both*, then update the
* _net_showing_desktop hint
*/
if (old && (old->showing_desktop ^ workspace->showing_desktop))
meta_screen_update_showing_desktop_hint (workspace->screen);
if (old == NULL)
return;
......
......@@ -49,6 +49,8 @@ struct _MetaWorkspace
GSList *top_struts;
GSList *bottom_struts;
guint work_areas_invalid : 1;
guint showing_desktop : 1;
};
MetaWorkspace* meta_workspace_new (MetaScreen *screen);
......
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