mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
screen: Simplify meta_screen_get_workspace_by_index
This commit is contained in:
parent
7adfaceccf
commit
320f38de47
@ -1055,27 +1055,7 @@ MetaWorkspace*
|
|||||||
meta_screen_get_workspace_by_index (MetaScreen *screen,
|
meta_screen_get_workspace_by_index (MetaScreen *screen,
|
||||||
int idx)
|
int idx)
|
||||||
{
|
{
|
||||||
GList *tmp;
|
return g_list_nth_data (screen->workspaces, idx);
|
||||||
int i;
|
|
||||||
|
|
||||||
/* should be robust, idx is maybe from an app */
|
|
||||||
if (idx < 0)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
i = 0;
|
|
||||||
tmp = screen->workspaces;
|
|
||||||
while (tmp != NULL)
|
|
||||||
{
|
|
||||||
MetaWorkspace *w = tmp->data;
|
|
||||||
|
|
||||||
if (i == idx)
|
|
||||||
return w;
|
|
||||||
|
|
||||||
++i;
|
|
||||||
tmp = tmp->next;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user