summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/keybindings.c2
-rw-r--r--src/screen.c51
-rw-r--r--src/screen.h10
-rw-r--r--src/window.c7
-rw-r--r--src/workspace.c10
-rw-r--r--src/workspace.h2
6 files changed, 46 insertions, 36 deletions
diff --git a/src/keybindings.c b/src/keybindings.c
index 18279cb1..14b098d3 100644
--- a/src/keybindings.c
+++ b/src/keybindings.c
@@ -2773,7 +2773,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,
diff --git a/src/screen.c b/src/screen.c
index 35f8e293..be1944b0 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -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);
diff --git a/src/screen.h b/src/screen.h
index f8eb7716..30b45d01 100644
--- a/src/screen.h
+++ b/src/screen.h
@@ -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);
diff --git a/src/window.c b/src/window.c
index 95300ad7..e40d8091 100644
--- a/src/window.c
+++ b/src/window.c
@@ -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",
diff --git a/src/workspace.c b/src/workspace.c
index 3cf55f52..205363ff 100644
--- a/src/workspace.c
+++ b/src/workspace.c
@@ -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;
diff --git a/src/workspace.h b/src/workspace.h
index 018d1dfb..403a73ea 100644
--- a/src/workspace.h
+++ b/src/workspace.h
@@ -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);