-static GList *pick_group_windows_recur(ObClient *top, ObClient *selected,
- gboolean raise, gboolean normal)
-{
- GList *ret = NULL;
- GList *it, *next, *prev;
- GSList *sit;
- gint i, n;
-
- /* add group members in their stacking order */
- if (top->group) {
- i = 0;
- n = g_slist_length(top->group->members) - 1;
- for (it = stacking_list; i < n && it; it = next) {
- prev = g_list_previous(it);
- next = g_list_next(it);
-
- if ((sit = g_slist_find(top->group->members, it->data))) {
- ObClient *c;
- ObClientType t;
-
- ++i;
- c = it->data;
- t = c->type;
-
- if ((c->desktop == selected->desktop ||
- c->desktop == DESKTOP_ALL) &&
- (t == OB_CLIENT_TYPE_TOOLBAR ||
- t == OB_CLIENT_TYPE_MENU ||
- t == OB_CLIENT_TYPE_UTILITY ||
- (normal && t == OB_CLIENT_TYPE_NORMAL)))
- {
- ret = g_list_concat(ret,
- pick_windows_recur(sit->data,
- selected, raise));
- /* 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;
- }
- }
+ /* save this position in the stacking list */
+ below = last;
+
+ /* find where to put the group transients, start from the top of list */
+ for (it = stacking_list; it; it = g_list_next(it)) {
+ /* skip past higher layers */
+ if (window_layer(it->data) > selected->layer)
+ continue;
+ /* if we reach the end of the layer (how?) then don't go further */
+ if (window_layer(it->data) < selected->layer)
+ break;
+ /* stop when we reach the first window in the group */
+ if (WINDOW_IS_CLIENT(it->data)) {
+ ObClient *c = it->data;
+ if (c->group == selected->group)
+ break;