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>
This commit is contained in:
Sebastian Wick 2022-12-07 18:20:49 +01:00 committed by Marge Bot
parent 058981dc12
commit 0d69fabbe6

View File

@ -4598,9 +4598,9 @@ meta_window_focus (MetaWindow *window,
META_WINDOW_GET_CLASS (window)->focus (window, timestamp); META_WINDOW_GET_CLASS (window)->focus (window, timestamp);
/* Move to the front of the focusing workspace's MRU list. /* Move to the front of all workspaces' MRU lists the window
* We should only be "removing" it from the MRU list if it's * is on. We should only be "removing" it from the MRU list if
* not already there. Note that it's possible that we might * it's already there. Note that it's possible that we might
* be processing this FocusIn after we've changed to a * be processing this FocusIn after we've changed to a
* different workspace; we should therefore update the MRU * different workspace; we should therefore update the MRU
* list only if the window is actually on the active * list only if the window is actually on the active
@ -4610,20 +4610,20 @@ meta_window_focus (MetaWindow *window,
meta_window_located_on_workspace (window, meta_window_located_on_workspace (window,
workspace_manager->active_workspace)) workspace_manager->active_workspace))
{ {
GList *link; GList *l;
link = g_list_find (workspace_manager->active_workspace->mru_list, for (l = workspace_manager->workspaces; l != NULL; l = l->next)
window); {
g_assert (link); MetaWorkspace *workspace = l->data;
GList *link;
workspace_manager->active_workspace->mru_list = link = g_list_find (workspace->mru_list, window);
g_list_remove_link (workspace_manager->active_workspace->mru_list, if (!link)
link); continue;
g_list_free (link);
workspace_manager->active_workspace->mru_list = workspace->mru_list = g_list_delete_link (workspace->mru_list, link);
g_list_prepend (workspace_manager->active_workspace->mru_list, workspace->mru_list = g_list_prepend (workspace->mru_list, window);
window); }
} }
backend = meta_get_backend (); backend = meta_get_backend ();