- if (WINDOW_IS_CLIENT(window)) {
- Client *client = WINDOW_AS_CLIENT(window);
- /* 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;
-
- /* the check for TRAN_GROUP is to prevent an infinate loop with
- 2 transients of the same group at the head of the group's
- members list */
- for (it = client->group->members; it; it = it->next) {
- Client *c = it->data;
-
- if (c != client && c->transient_for != TRAN_GROUP) {
- client = it->data;
- break;
- }
+ if (window_layer(window) != window_layer(below))
+ return;
+
+ wins = g_list_append(NULL, window);
+ stacking_list = g_list_remove(stacking_list, window);
+ before = g_list_next(g_list_find(stacking_list, below));
+ do_restack(wins, before);
+ g_list_free(wins);
+}
+
+void stacking_add(ObWindow *win)
+{
+ ObStackingLayer l;
+ GList *wins;
+
+ g_assert(screen_support_win != None); /* make sure I dont break this in the
+ future */
+
+ l = window_layer(win);
+ wins = g_list_append(NULL, win); /* list of 1 element */
+
+ stacking_list = g_list_append(stacking_list, win);
+ stacking_raise(win);
+}
+
+void stacking_add_nonintrusive(ObWindow *win)
+{
+ ObClient *client;
+ ObClient *parent = NULL;
+ GList *it_before = NULL;
+
+ if (!WINDOW_IS_CLIENT(win)) {
+ stacking_add(win); /* no special rules for others */
+ return;
+ }
+
+ client = WINDOW_AS_CLIENT(win);
+
+ /* insert above its highest parent */
+ if (client->transient_for) {
+ if (client->transient_for != OB_TRAN_GROUP) {
+ parent = client->transient_for;
+ } else {
+ GSList *sit;
+ GList *it;
+
+ if (client->group)
+ for (it = stacking_list; !parent && it; it = g_list_next(it)) {
+ if ((sit = g_slist_find(client->group->members, it->data)))
+ for (sit = client->group->members; !parent && sit;
+ sit = g_slist_next(sit))
+ {
+ ObClient *c = sit->data;
+ /* checking transient_for prevents infinate loops! */
+ if (sit->data == it->data && !c->transient_for)
+ parent = it->data;