summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Adams <readams@readams.net>2003-12-14 19:19:26 +0000
committerHavoc Pennington <hp@src.gnome.org>2003-12-14 19:19:26 +0000
commitdc4104e9eb17ad23340089c9240611391bacaea5 (patch)
tree4be337a11659ce13df9d9d8627a4cc931d7c2f98
parent39ed3c0f7a2950b3f301e6bbd4b448202efef06b (diff)
downloadmetacity-dc4104e9eb17ad23340089c9240611391bacaea5.tar.gz
set on_all_workspaces in all cases _before_ adding to the workspaces, so
2003-12-13 Rob Adams <readams@readams.net> * src/window.c (meta_window_new_with_attrs): set on_all_workspaces in all cases _before_ adding to the workspaces, so that windows initially on all workspaces are added correctly to the MRU lists. Fix for #120907. * src/workspace.c (meta_workspace_add_window): handle sticky windows so that we add to add mru lists if needed (meta_workspace_remove_window): handle sticky windows so that they are removed from all mru lists if needed.
-rw-r--r--ChangeLog12
-rw-r--r--src/window.c34
-rw-r--r--src/workspace.c51
3 files changed, 77 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog
index 38135b53..31b018d5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2003-12-13 Rob Adams <readams@readams.net>
+
+ * src/window.c (meta_window_new_with_attrs): set on_all_workspaces
+ in all cases _before_ adding to the workspaces, so that windows
+ initially on all workspaces are added correctly to the MRU lists.
+ Fix for #120907.
+
+ * src/workspace.c (meta_workspace_add_window): handle sticky
+ windows so that we add to add mru lists if needed
+ (meta_workspace_remove_window): handle sticky windows so that they
+ are removed from all mru lists if needed.
+
2003-12-12 Havoc Pennington <hp@redhat.com>
* src/window.c (meta_window_free): unstick window to get it out of
diff --git a/src/window.c b/src/window.c
index 11cebbd7..8a064925 100644
--- a/src/window.c
+++ b/src/window.c
@@ -558,6 +558,17 @@ meta_window_new (MetaDisplay *display,
meta_window_grab_keys (window);
meta_display_grab_window_buttons (window->display, window->xwindow);
meta_display_grab_focus_window_button (window->display, window);
+
+ if (window->type == META_WINDOW_DESKTOP ||
+ window->type == META_WINDOW_DOCK)
+ {
+ /* Change the default, but don't enforce this if the user
+ * focuses the dock/desktop and unsticks it using key shortcuts.
+ * Need to set this before adding to the workspaces so the MRU
+ * lists will be updated.
+ */
+ window->on_all_workspaces = TRUE;
+ }
/* For the workspace, first honor hints,
* if that fails put transients with parents,
@@ -572,8 +583,11 @@ meta_window_new (MetaDisplay *display,
"Window %s is initially on all spaces\n",
window->desc);
- meta_workspace_add_window (window->screen->active_workspace, window);
+ /* need to set on_all_workspaces first so that it will be
+ * added to all the MRU lists
+ */
window->on_all_workspaces = TRUE;
+ meta_workspace_add_window (window->screen->active_workspace, window);
}
else
{
@@ -613,6 +627,8 @@ meta_window_new (MetaDisplay *display,
tmp_list = parent->workspaces;
while (tmp_list != NULL)
{
+ /* this will implicitly add to the appropriate MRU lists
+ */
meta_workspace_add_window (tmp_list->data, window);
tmp_list = tmp_list->next;
@@ -631,16 +647,6 @@ meta_window_new (MetaDisplay *display,
meta_workspace_add_window (space, window);
}
- if (window->type == META_WINDOW_DESKTOP ||
- window->type == META_WINDOW_DOCK)
- {
- /* Change the default, but don't enforce this if
- * the user focuses the dock/desktop and unsticks it
- * using key shortcuts
- */
- window->on_all_workspaces = TRUE;
- }
-
/* for the various on_all_workspaces = TRUE possible above */
meta_window_set_current_workspace_hint (window);
@@ -921,12 +927,6 @@ meta_window_free (MetaWindow *window)
meta_window_unqueue_move_resize (window);
meta_window_unqueue_update_icon (window);
meta_window_free_delete_dialog (window);
-
- /* We need to unstick to remove the window from
- * any workspace->mru_list for workspaces not
- * in window->workspaces
- */
- meta_window_unstick (window);
tmp = window->workspaces;
while (tmp != NULL)
diff --git a/src/workspace.c b/src/workspace.c
index e8a820df..25868c1c 100644
--- a/src/workspace.c
+++ b/src/workspace.c
@@ -112,11 +112,33 @@ meta_workspace_add_window (MetaWorkspace *workspace,
{
g_return_if_fail (!meta_workspace_contains_window (workspace, window));
+ /* If the window is on all workspaces, we want to add it to all mru
+ * lists, otherwise just add it to this workspaces mru list
+ */
+ if (window->on_all_workspaces)
+ {
+ if (window->workspaces == NULL)
+ {
+ GList* tmp = window->screen->workspaces;
+ while (tmp)
+ {
+ MetaWorkspace* work = (MetaWorkspace*) tmp->data;
+ if (!g_list_find (work->mru_list, window))
+ work->mru_list = g_list_append (work->mru_list, window);
+
+ tmp = tmp->next;
+ }
+ }
+ }
+ else
+ {
+ g_assert (g_list_find (workspace->mru_list, window) == NULL);
+ workspace->mru_list = g_list_append (workspace->mru_list, window);
+ }
+
workspace->windows = g_list_prepend (workspace->windows, window);
window->workspaces = g_list_prepend (window->workspaces, workspace);
- workspace->mru_list = g_list_append (workspace->mru_list, window);
-
meta_window_set_current_workspace_hint (window);
meta_window_queue_calc_showing (window);
@@ -142,7 +164,30 @@ meta_workspace_remove_window (MetaWorkspace *workspace,
workspace->windows = g_list_remove (workspace->windows, window);
window->workspaces = g_list_remove (window->workspaces, workspace);
- workspace->mru_list = g_list_remove (workspace->mru_list, window);
+
+ /* If the window is on all workspaces, we don't want to remove it
+ * from the MRU list unless this causes it to be removed from all
+ * workspaces
+ */
+ if (window->on_all_workspaces)
+ {
+ if (window->workspaces == NULL)
+ {
+ GList* tmp = window->screen->workspaces;
+ while (tmp)
+ {
+ MetaWorkspace* work = (MetaWorkspace*) tmp->data;
+ work->mru_list = g_list_remove (work->mru_list, window);
+
+ tmp = tmp->next;
+ }
+ }
+ }
+ else
+ {
+ workspace->mru_list = g_list_remove (workspace->mru_list, window);
+ g_assert (g_list_find (workspace->mru_list, window) == NULL);
+ }
meta_window_set_current_workspace_hint (window);