speed up pick_group_windows too

This commit is contained in:
Dana Jansens 2003-07-10 05:35:22 +00:00
parent 38d3cad249
commit 416b9d5f5f

View file

@ -199,7 +199,7 @@ static GList *pick_windows(Client *top, Client *selected, gboolean raise)
static GList *pick_group_windows(Client *top, Client *selected, gboolean raise) static GList *pick_group_windows(Client *top, Client *selected, gboolean raise)
{ {
GList *ret = NULL; GList *ret = NULL;
GList *it, *next; GList *it, *next, *prev;
GSList *sit; GSList *sit;
int i, n; int i, n;
@ -208,12 +208,16 @@ static GList *pick_group_windows(Client *top, Client *selected, gboolean raise)
i = 0; i = 0;
n = g_slist_length(top->group->members) - 1; n = g_slist_length(top->group->members) - 1;
for (it = stacking_list; i < n && it; it = next) { for (it = stacking_list; i < n && it; it = next) {
prev = g_list_previous(it);
next = g_list_next(it); next = g_list_next(it);
if ((sit = g_slist_find(top->group->members, it->data))) { if ((sit = g_slist_find(top->group->members, it->data))) {
++i; ++i;
ret = g_list_concat(ret, pick_windows(sit->data, ret = g_list_concat(ret,
selected, raise)); pick_windows(sit->data, selected, raise));
it = stacking_list; /* if we dont have a prev then start back at the beginning,
otherwise skip back to the prev's next */
next = prev ? g_list_next(prev) : stacking_list;
} }
} }
} }