display: Clean up meta_display_get_tab_list()

https://bugzilla.gnome.org/show_bug.cgi?id=688913
This commit is contained in:
Florian Müllner 2012-12-04 00:05:22 +01:00
parent c6fcc79e6a
commit 3797ecaa65

View File

@ -4762,76 +4762,53 @@ meta_display_get_tab_list (MetaDisplay *display,
MetaScreen *screen, MetaScreen *screen,
MetaWorkspace *workspace) MetaWorkspace *workspace)
{ {
GList *tab_list; GList *tab_list = NULL;
GList *tmp;
GSList *windows = meta_display_list_windows (display, META_LIST_DEFAULT);
GSList *w;
g_return_val_if_fail (workspace != NULL, NULL); g_return_val_if_fail (workspace != NULL, NULL);
/* Windows sellout mode - MRU order. Collect unminimized windows /* Windows sellout mode - MRU order. Collect unminimized windows
* then minimized so minimized windows aren't in the way so much. * then minimized so minimized windows aren't in the way so much.
*/ */
{ for (tmp = workspace->mru_list; tmp; tmp = tmp->next)
GList *tmp; {
MetaWindow *window = tmp->data;
tab_list = NULL;
tmp = workspace->mru_list;
while (tmp != NULL)
{
MetaWindow *window = tmp->data;
if (!window->minimized &&
window->screen == screen &&
IN_TAB_CHAIN (window, type))
tab_list = g_list_prepend (tab_list, window);
tmp = tmp->next;
}
}
{ if (!window->minimized &&
GList *tmp; window->screen == screen &&
IN_TAB_CHAIN (window, type))
tmp = workspace->mru_list; tab_list = g_list_prepend (tab_list, window);
while (tmp != NULL) }
{
MetaWindow *window = tmp->data; for (tmp = workspace->mru_list; tmp; tmp = tmp->next)
{
if (window->minimized && MetaWindow *window = tmp->data;
window->screen == screen &&
IN_TAB_CHAIN (window, type)) if (window->minimized &&
tab_list = g_list_prepend (tab_list, window); window->screen == screen &&
IN_TAB_CHAIN (window, type))
tmp = tmp->next; tab_list = g_list_prepend (tab_list, window);
} }
}
tab_list = g_list_reverse (tab_list); tab_list = g_list_reverse (tab_list);
{ for (w = windows; w; w = w->next)
GSList *windows, *tmp; {
MetaWindow *l_window; MetaWindow *l_window = w->data;
windows = meta_display_list_windows (display, META_LIST_DEFAULT); /* Check to see if it demands attention */
if (l_window->wm_state_demands_attention &&
l_window->workspace != workspace &&
IN_TAB_CHAIN (l_window, type))
{
/* if it does, add it to the popup */
tab_list = g_list_prepend (tab_list, l_window);
}
}
/* Go through all windows */ g_slist_free (windows);
tmp = windows;
while (tmp != NULL)
{
l_window=tmp->data;
/* Check to see if it demands attention */
if (l_window->wm_state_demands_attention &&
l_window->workspace!=workspace &&
IN_TAB_CHAIN (l_window, type))
{
/* if it does, add it to the popup */
tab_list = g_list_prepend (tab_list, l_window);
}
tmp = tmp->next;
} /* End while tmp!=NULL */
g_slist_free (windows);
}
return tab_list; return tab_list;
} }