void meta_workspace_invalidate_work_area (MetaWorkspace *workspace) { GList *tmp; GList *windows; int i; if (workspace->work_areas_invalid) { meta_topic (META_DEBUG_WORKAREA, "Work area for workspace %d is already invalid\n", meta_workspace_index (workspace)); return; } meta_topic (META_DEBUG_WORKAREA, "Invalidating work area for workspace %d\n", meta_workspace_index (workspace)); /* If we are in the middle of a resize or move operation, we * might have cached pointers to the workspace's edges */ if (workspace == workspace->screen->active_workspace) meta_display_cleanup_edges (workspace->screen->display); g_free (workspace->work_area_monitor); workspace->work_area_monitor = NULL; workspace_free_struts (workspace); for (i = 0; i < workspace->screen->n_monitor_infos; i++) g_list_free_full (workspace->monitor_region[i], g_free); g_free (workspace->monitor_region); g_list_free_full (workspace->screen_region, g_free); g_list_free_full (workspace->screen_edges, g_free); g_list_free_full (workspace->monitor_edges, g_free); workspace->monitor_region = NULL; workspace->screen_region = NULL; workspace->screen_edges = NULL; workspace->monitor_edges = NULL; workspace->work_areas_invalid = TRUE; /* redo the size/position constraints on all windows */ windows = meta_workspace_list_windows (workspace); tmp = windows; while (tmp != NULL) { MetaWindow *w = tmp->data; meta_window_queue (w, META_QUEUE_MOVE_RESIZE); tmp = tmp->next; } g_list_free (windows); meta_screen_queue_workarea_recalc (workspace->screen); }
void meta_workspace_invalidate_work_area (MetaWorkspace *workspace) { GList *tmp; GList *windows; int i; if (workspace->work_areas_invalid) { meta_topic (META_DEBUG_WORKAREA, "Work area for workspace %d is already invalid\n", meta_workspace_index (workspace)); return; } meta_topic (META_DEBUG_WORKAREA, "Invalidating work area for workspace %d\n", meta_workspace_index (workspace)); g_free (workspace->work_area_xinerama); workspace->work_area_xinerama = NULL; workspace_free_struts (workspace); for (i = 0; i < workspace->screen->n_xinerama_infos; i++) meta_rectangle_free_list_and_elements (workspace->xinerama_region[i]); g_free (workspace->xinerama_region); meta_rectangle_free_list_and_elements (workspace->screen_region); meta_rectangle_free_list_and_elements (workspace->screen_edges); meta_rectangle_free_list_and_elements (workspace->xinerama_edges); workspace->xinerama_region = NULL; workspace->screen_region = NULL; workspace->screen_edges = NULL; workspace->xinerama_edges = NULL; workspace->work_areas_invalid = TRUE; /* redo the size/position constraints on all windows */ windows = meta_workspace_list_windows (workspace); tmp = windows; while (tmp != NULL) { MetaWindow *w = tmp->data; meta_window_queue (w, META_QUEUE_MOVE_RESIZE); tmp = tmp->next; } g_list_free (windows); meta_screen_queue_workarea_recalc (workspace->screen); }
void meta_workspace_free (MetaWorkspace *workspace) { GList *tmp; MetaScreen *screen; int i; g_return_if_fail (workspace != workspace->screen->active_workspace); /* Here we assume all the windows are already on another workspace * as well, so they won't be "orphaned" */ tmp = workspace->windows; while (tmp != NULL) { GList *next; MetaWindow *window = tmp->data; next = tmp->next; /* pop front of list we're iterating over */ meta_workspace_remove_window (workspace, window); g_assert (window->workspace != NULL); tmp = next; } g_assert (workspace->windows == NULL); screen = workspace->screen; workspace->screen->workspaces = g_list_remove (workspace->screen->workspaces, workspace); g_free (workspace->work_area_xinerama); g_list_free (workspace->mru_list); g_list_free (workspace->list_containing_self); /* screen.c:update_num_workspaces(), which calls us, removes windows from * workspaces first, which can cause the workareas on the workspace to be * invalidated (and hence for struts/regions/edges to be freed). * So, no point trying to double free it; that causes a crash * anyway. #361804. */ if (!workspace->work_areas_invalid) { workspace_free_struts (workspace); for (i = 0; i < screen->n_xinerama_infos; i++) meta_rectangle_free_list_and_elements (workspace->xinerama_region[i]); g_free (workspace->xinerama_region); meta_rectangle_free_list_and_elements (workspace->screen_region); meta_rectangle_free_list_and_elements (workspace->screen_edges); meta_rectangle_free_list_and_elements (workspace->xinerama_edges); } g_free (workspace); /* don't bother to reset names, pagers can just ignore * extra ones */ }