- if (WINDOW_IS_CLIENT(window)) {
- Client *client = WINDOW_AS_CLIENT(window);
-
- /* move up the transient chain as far as possible first */
- if (client->transient_for) {
- if (client->transient_for != TRAN_GROUP) {
- stacking_raise(CLIENT_AS_WINDOW(client->transient_for));
- return;
- } else {
- GSList *it;
- gboolean raised = FALSE;
-
- for (it = client->group->members; it; it = it->next) {
- Client *c = it->data;
-
- /* checking transient_for prevents infinate loops! */
- if (c != client && !c->transient_for) {
- stacking_raise(it->data);
- raised = TRUE;
- }
+ /* call restack for each of these to lower them */
+ for (top_it = top_reorder; top_it; top_it = g_slist_next(top_it))
+ restack_windows(top_it->data, raise);
+ return;
+ }
+ }
+
+ /* remove first so we can't run into ourself */
+ it = g_list_find(stacking_list, selected);
+ g_assert(it);
+ stacking_list = g_list_delete_link(stacking_list, it);
+
+ /* go from the bottom of the stacking list up */
+ for (it = g_list_last(stacking_list); it; it = next) {
+ next = g_list_previous(it);
+
+ if (WINDOW_IS_CLIENT(it->data)) {
+ ObClient *ch = it->data;
+
+ /* only move windows in the same stacking layer */
+ if (ch->layer == selected->layer &&
+ client_search_transient(selected, ch))
+ {
+ if (client_is_direct_child(selected, ch)) {
+ if (ch->modal)
+ modals = g_list_prepend(modals, ch);
+ else
+ trans = g_list_prepend(trans, ch);
+ }
+ else {
+ if (ch->modal)
+ group_modals = g_list_prepend(group_modals, ch);
+ else
+ group_trans = g_list_prepend(group_trans, ch);