meta_screen_remove_workspace()

This commit is contained in:
Tomas Frydrych 2008-10-24 11:03:43 +01:00
parent f80e39e2ca
commit d1635d13cb
2 changed files with 47 additions and 0 deletions

View File

@ -1082,6 +1082,50 @@ set_desktop_viewport_hint (MetaScreen *screen)
meta_error_trap_pop (screen->display, FALSE);
}
void
meta_screen_remove_workspace (MetaScreen *screen, MetaWorkspace *workspace,
guint32 timestamp)
{
GList *l;
MetaWorkspace *neighbour = NULL;
l = screen->workspaces;
while (l)
{
MetaWorkspace *w = l->data;
if (w == workspace)
{
if (l->prev)
neighbour = l->prev->data;
else if (l->next)
neighbour = l->next->data;
else
{
/* Cannot remove the only workspace! */
return;
}
break;
}
l = l->next;
}
meta_workspace_relocate_windows (workspace, neighbour);
if (workspace == screen->active_workspace)
meta_workspace_activate (neighbour, timestamp);
/* This also removes the workspace from the screens list */
meta_workspace_free (workspace);
set_number_of_spaces_hint (screen, g_list_length (screen->workspaces));
meta_screen_queue_workarea_recalc (screen);
}
static void
update_num_workspaces (MetaScreen *screen,
guint32 timestamp)

View File

@ -49,5 +49,8 @@ GList *meta_screen_get_workspaces (MetaScreen *screen);
MetaWorkspace* meta_screen_get_workspace_by_index (MetaScreen *screen,
int index);
void meta_screen_remove_workspace (MetaScreen *screen,
MetaWorkspace *workspace,
guint32 timestamp);
#endif