workspace: Correctly initialize MRU list

The workspace MRU lists are updated when windows are managed/unmanaged
or change workspaces. However those updates obviously only apply to
existing workspaces - new workspaces will always start out with an empty
MRU list, despite sticky windows already being "on" that workspace.
As we now assert that the list contains all windows located on the
workspace, we need to initialize it correctly to avoid a crash.

https://bugzilla.gnome.org/show_bug.cgi?id=737581
This commit is contained in:
Florian Müllner 2014-09-29 23:02:02 +02:00
parent 9f8b641472
commit 4f3de2ce39

View File

@ -170,6 +170,7 @@ MetaWorkspace*
meta_workspace_new (MetaScreen *screen) meta_workspace_new (MetaScreen *screen)
{ {
MetaWorkspace *workspace; MetaWorkspace *workspace;
GSList *windows, *l;
workspace = g_object_new (META_TYPE_WORKSPACE, NULL); workspace = g_object_new (META_TYPE_WORKSPACE, NULL);
@ -179,6 +180,13 @@ meta_workspace_new (MetaScreen *screen)
workspace->windows = NULL; workspace->windows = NULL;
workspace->mru_list = NULL; workspace->mru_list = NULL;
/* make sure sticky windows are in our mru_list */
windows = meta_display_list_windows (screen->display, META_LIST_SORTED);
for (l = windows; l; l = l->next)
if (meta_window_located_on_workspace (l->data, workspace))
meta_workspace_add_window (workspace, l->data);
g_slist_free (windows);
workspace->work_areas_invalid = TRUE; workspace->work_areas_invalid = TRUE;
workspace->work_area_monitor = NULL; workspace->work_area_monitor = NULL;
workspace->work_area_screen.x = 0; workspace->work_area_screen.x = 0;