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,19 +4762,17 @@ meta_display_get_tab_list (MetaDisplay *display,
MetaScreen *screen,
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);
/* Windows sellout mode - MRU order. Collect unminimized windows
* then minimized so minimized windows aren't in the way so much.
*/
{
GList *tmp;
tab_list = NULL;
tmp = workspace->mru_list;
while (tmp != NULL)
for (tmp = workspace->mru_list; tmp; tmp = tmp->next)
{
MetaWindow *window = tmp->data;
@ -4782,16 +4780,9 @@ meta_display_get_tab_list (MetaDisplay *display,
window->screen == screen &&
IN_TAB_CHAIN (window, type))
tab_list = g_list_prepend (tab_list, window);
tmp = tmp->next;
}
}
{
GList *tmp;
tmp = workspace->mru_list;
while (tmp != NULL)
for (tmp = workspace->mru_list; tmp; tmp = tmp->next)
{
MetaWindow *window = tmp->data;
@ -4799,39 +4790,25 @@ meta_display_get_tab_list (MetaDisplay *display,
window->screen == screen &&
IN_TAB_CHAIN (window, type))
tab_list = g_list_prepend (tab_list, window);
tmp = tmp->next;
}
}
tab_list = g_list_reverse (tab_list);
for (w = windows; w; w = w->next)
{
GSList *windows, *tmp;
MetaWindow *l_window;
windows = meta_display_list_windows (display, META_LIST_DEFAULT);
/* Go through all windows */
tmp = windows;
while (tmp != NULL)
{
l_window=tmp->data;
MetaWindow *l_window = w->data;
/* Check to see if it demands attention */
if (l_window->wm_state_demands_attention &&
l_window->workspace!=workspace &&
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;
}