summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Wick <sebastian.wick@redhat.com>2022-12-07 18:20:49 +0100
committerRobert Mader <robert.mader@collabora.com>2023-01-06 13:50:41 +0100
commit0d666743aa65e8414c6c3755d341edd9767cffdb (patch)
treea5f79db74d44081d22fb7c0d8866726f48506769
parentd5dd42694d64b4cc8fac65aeb937471af8bdf27b (diff)
downloadmutter-0d666743aa65e8414c6c3755d341edd9767cffdb.tar.gz
window: Update mru list for every workspace the window is on
If the window is on all workspaces we should update the mru list for all those workspaces, otherwise the default focus window for a specific workspace can be unexpected. Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2548 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2747> (cherry picked from commit 0d69fabbe6895fdac31e044060ed16bd1f1c344a)
-rw-r--r--src/core/window.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/core/window.c b/src/core/window.c
index c5ee5af50..f32a7e674 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -4596,9 +4596,9 @@ meta_window_focus (MetaWindow *window,
META_WINDOW_GET_CLASS (window)->focus (window, timestamp);
- /* Move to the front of the focusing workspace's MRU list.
- * We should only be "removing" it from the MRU list if it's
- * not already there. Note that it's possible that we might
+ /* Move to the front of all workspaces' MRU lists the window
+ * is on. We should only be "removing" it from the MRU list if
+ * it's already there. Note that it's possible that we might
* be processing this FocusIn after we've changed to a
* different workspace; we should therefore update the MRU
* list only if the window is actually on the active
@@ -4608,20 +4608,20 @@ meta_window_focus (MetaWindow *window,
meta_window_located_on_workspace (window,
workspace_manager->active_workspace))
{
- GList *link;
+ GList *l;
- link = g_list_find (workspace_manager->active_workspace->mru_list,
- window);
- g_assert (link);
+ for (l = workspace_manager->workspaces; l != NULL; l = l->next)
+ {
+ MetaWorkspace *workspace = l->data;
+ GList *link;
- workspace_manager->active_workspace->mru_list =
- g_list_remove_link (workspace_manager->active_workspace->mru_list,
- link);
- g_list_free (link);
+ link = g_list_find (workspace->mru_list, window);
+ if (!link)
+ continue;
- workspace_manager->active_workspace->mru_list =
- g_list_prepend (workspace_manager->active_workspace->mru_list,
- window);
+ workspace->mru_list = g_list_delete_link (workspace->mru_list, link);
+ workspace->mru_list = g_list_prepend (workspace->mru_list, window);
+ }
}
backend = meta_get_backend ();