1
0
Fork 0

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);
/* 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
@ -4610,20 +4610,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 ();