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
This commit is contained in:
Elijah Newren 2004-10-17 04:28:29 +00:00 committed by Elijah Newren
parent e6fe440612
commit e84778d1eb
7 changed files with 85 additions and 36 deletions

View File

@ -1,3 +1,42 @@
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> 2004-10-16 Elijah Newren <newren@math.utah.edu>
* rationales.txt: Add new tracker bugs * rationales.txt: Add new tracker bugs

View File

@ -2805,7 +2805,7 @@ handle_toggle_desktop (MetaDisplay *display,
XEvent *event, XEvent *event,
MetaKeyBinding *binding) MetaKeyBinding *binding)
{ {
if (screen->showing_desktop) if (screen->active_workspace->showing_desktop)
{ {
meta_screen_unshow_desktop (screen); meta_screen_unshow_desktop (screen);
meta_workspace_focus_default_window (screen->active_workspace, meta_workspace_focus_default_window (screen->active_workspace,

View File

@ -539,8 +539,6 @@ meta_screen_new (MetaDisplay *display,
screen->vertical_workspaces = FALSE; screen->vertical_workspaces = FALSE;
screen->starting_corner = META_SCREEN_TOPLEFT; screen->starting_corner = META_SCREEN_TOPLEFT;
screen->showing_desktop = FALSE;
screen->compositor_windows = NULL; screen->compositor_windows = NULL;
screen->damage_region = None; screen->damage_region = None;
screen->root_picture = None; screen->root_picture = None;
@ -2166,12 +2164,12 @@ meta_screen_resize (MetaScreen *screen,
meta_screen_foreach_window (screen, meta_screen_resize_func, 0); meta_screen_foreach_window (screen, meta_screen_resize_func, 0);
} }
static void void
update_showing_desktop_hint (MetaScreen *screen) meta_screen_update_showing_desktop_hint (MetaScreen *screen)
{ {
unsigned long data[1]; 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); meta_error_trap_push (screen->display);
XChangeProperty (screen->display->xdisplay, screen->xroot, XChangeProperty (screen->display->xdisplay, screen->xroot,
@ -2184,10 +2182,10 @@ update_showing_desktop_hint (MetaScreen *screen)
static void static void
queue_windows_showing (MetaScreen *screen) queue_windows_showing (MetaScreen *screen)
{ {
GSList *windows; GList *windows;
GSList *tmp; GList *tmp;
windows = meta_display_list_windows (screen->display); windows = screen->active_workspace->windows;
tmp = windows; tmp = windows;
while (tmp != NULL) while (tmp != NULL)
@ -2199,18 +2197,16 @@ queue_windows_showing (MetaScreen *screen)
tmp = tmp->next; tmp = tmp->next;
} }
g_slist_free (windows);
} }
void void
meta_screen_minimize_all_except (MetaScreen *screen, meta_screen_minimize_all_on_active_workspace_except (MetaScreen *screen,
MetaWindow *keep) MetaWindow *keep)
{ {
GSList *windows; GList *windows;
GSList *tmp; GList *tmp;
windows = meta_display_list_windows (screen->display); windows = screen->active_workspace->windows;
tmp = windows; tmp = windows;
while (tmp != NULL) while (tmp != NULL)
@ -2224,36 +2220,35 @@ meta_screen_minimize_all_except (MetaScreen *screen,
tmp = tmp->next; tmp = tmp->next;
} }
g_slist_free (windows);
} }
void void
meta_screen_show_desktop (MetaScreen *screen) meta_screen_show_desktop (MetaScreen *screen)
{ {
if (screen->showing_desktop) if (screen->active_workspace->showing_desktop)
return; return;
screen->showing_desktop = TRUE; screen->active_workspace->showing_desktop = TRUE;
queue_windows_showing (screen); queue_windows_showing (screen);
update_showing_desktop_hint (screen); meta_screen_update_showing_desktop_hint (screen);
} }
void void
meta_screen_unshow_desktop (MetaScreen *screen) meta_screen_unshow_desktop (MetaScreen *screen)
{ {
if (!screen->showing_desktop) if (!screen->active_workspace->showing_desktop)
return; return;
screen->showing_desktop = FALSE; screen->active_workspace->showing_desktop = FALSE;
queue_windows_showing (screen); queue_windows_showing (screen);
update_showing_desktop_hint (screen); meta_screen_update_showing_desktop_hint (screen);
} }
#ifdef HAVE_STARTUP_NOTIFICATION #ifdef HAVE_STARTUP_NOTIFICATION
static gboolean startup_sequence_timeout (void *data); static gboolean startup_sequence_timeout (void *data);

View File

@ -108,7 +108,6 @@ struct _MetaScreen
guint keys_grabbed : 1; guint keys_grabbed : 1;
guint all_keys_grabbed : 1; guint all_keys_grabbed : 1;
guint showing_desktop : 1;
int closing; int closing;
@ -197,13 +196,16 @@ void meta_screen_resize (MetaScreen *screen,
int width, int width,
int height); int height);
void meta_screen_minimize_all_except (MetaScreen *screen, void meta_screen_minimize_all_on_active_workspace_except (MetaScreen *screen,
MetaWindow *keep); MetaWindow *keep);
/* Show/hide the desktop (temporarily hide all windows) */ /* Show/hide the desktop (temporarily hide all windows) */
void meta_screen_show_desktop (MetaScreen *screen); void meta_screen_show_desktop (MetaScreen *screen);
void meta_screen_unshow_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, void meta_screen_apply_startup_properties (MetaScreen *screen,
MetaWindow *window); MetaWindow *window);

View File

@ -158,7 +158,7 @@ maybe_leave_show_desktop_mode (MetaWindow *window)
{ {
gboolean is_desktop_or_dock; gboolean is_desktop_or_dock;
if (!window->screen->showing_desktop) if (!window->screen->active_workspace->showing_desktop)
return; return;
/* If the window is a transient for the dock or desktop, don't /* 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) 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); meta_screen_unshow_desktop (window->screen);
} }
} }
@ -1265,7 +1266,7 @@ window_should_be_showing (MetaWindow *window)
&is_desktop_or_dock); &is_desktop_or_dock);
if (showing && if (showing &&
window->screen->showing_desktop && window->screen->active_workspace->showing_desktop &&
!is_desktop_or_dock) !is_desktop_or_dock)
{ {
meta_verbose ("Window %s is on current workspace, but we're showing the desktop\n", meta_verbose ("Window %s is on current workspace, but we're showing the desktop\n",

View File

@ -68,6 +68,8 @@ meta_workspace_new (MetaScreen *screen)
workspace->top_struts = NULL; workspace->top_struts = NULL;
workspace->bottom_struts = NULL; workspace->bottom_struts = NULL;
workspace->showing_desktop = FALSE;
return workspace; return workspace;
} }
@ -283,12 +285,20 @@ meta_workspace_activate_with_focus (MetaWorkspace *workspace,
if (workspace->screen->active_workspace == workspace) if (workspace->screen->active_workspace == workspace)
return; return;
/* Note that old can be NULL; e.g. when starting up */
old = workspace->screen->active_workspace; old = workspace->screen->active_workspace;
workspace->screen->active_workspace = workspace; workspace->screen->active_workspace = workspace;
set_active_space_hint (workspace->screen); 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) if (old == NULL)
return; return;

View File

@ -49,6 +49,8 @@ struct _MetaWorkspace
GSList *top_struts; GSList *top_struts;
GSList *bottom_struts; GSList *bottom_struts;
guint work_areas_invalid : 1; guint work_areas_invalid : 1;
guint showing_desktop : 1;
}; };
MetaWorkspace* meta_workspace_new (MetaScreen *screen); MetaWorkspace* meta_workspace_new (MetaScreen *screen);