- /* move up the transient chain as far as possible first */
- while (client->transient_for) {
- if (client->transient_for != TRAN_GROUP) {
- client = client->transient_for;
- } else {
- GSList *it;
+ if (!WINDOW_IS_CLIENT(win)) {
+ ret = g_list_append(ret, win);
+ stacking_list = g_list_remove(stacking_list, win);
+ return ret;
+ }
+ c = WINDOW_AS_CLIENT(win);
+
+ /* add transient children in their stacking order */
+ i = 0;
+ n = g_slist_length(c->transients);
+ for (it = stacking_list; i < n && it; it = next) {
+ next = g_list_next(it);
+ if ((sit = g_slist_find(c->transients, it->data))) {
+ ++i;
+ ret = g_list_concat(ret, pick_windows(sit->data));
+ }
+ }