X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fstacking.c;h=696ce354f09d6fec6ba348ee4fc21273d90c13fb;hb=b1f5555218ecaa3827450125dc47b4bf0d404ee4;hp=eac4025cfb9b089b24cddc574fa28729a84add78;hpb=6e42b65bda1706887f3b2a7f9d79ba20f7611a06;p=chaz%2Fopenbox diff --git a/openbox/stacking.c b/openbox/stacking.c index eac4025c..696ce354 100644 --- a/openbox/stacking.c +++ b/openbox/stacking.c @@ -112,6 +112,7 @@ void stacking_raise(ObWindow *window) 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) { @@ -119,17 +120,18 @@ void stacking_raise(ObWindow *window) return; } else { GSList *it; + gboolean raised = FALSE; - /* 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) + /* checking transient_for prevents infinate loops! */ + if (c != client && !c->transient_for) { stacking_raise(it->data); + raised = TRUE; + } } - if (it == NULL) return; + if (raised) return; } } } @@ -183,13 +185,11 @@ void stacking_lower(ObWindow *window) } 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) + /* checking transient_for prevents infinate loops! */ + if (c != client && !c->transient_for) stacking_lower(it->data); } if (it == NULL) return; @@ -228,15 +228,12 @@ void stacking_add_nonintrusive(ObWindow *win) GSList *sit; GList *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 = stacking_list; !parent && it; it = it->next) { for (sit = client->group->members; !parent && sit; sit = sit->next) { Client *c = sit->data; - if (sit->data == it->data && - c->transient_for != TRAN_GROUP) + /* checking transient_for prevents infinate loops! */ + if (sit->data == it->data && !c->transient_for) parent = it->data; } } @@ -246,23 +243,25 @@ void stacking_add_nonintrusive(ObWindow *win) if (!(it_before = g_list_find(stacking_list, parent))) { /* no parent to put above, try find the focused client to go under */ - if ((it_before = g_list_find(stacking_list, focus_client))) - it_before = it_before->next; - else { - /* out of ideas, just add it normally... */ - stacking_add(win); - return; + if (focus_client && focus_client->layer == client->layer) { + if ((it_before = g_list_find(stacking_list, focus_client))) + it_before = it_before->next; } } - stacking_list = g_list_insert_before(stacking_list, it_before, win); - - it_before = g_list_find(stacking_list, win)->prev; - if (!it_before) - wins[0] = focus_backup; - else - wins[0] = window_top(it_before->data); - wins[1] = window_top(win); - - XRestackWindows(ob_display, wins, 2); + if (!it_before) { + /* out of ideas, just add it normally... */ + stacking_add(win); + } else { + stacking_list = g_list_insert_before(stacking_list, it_before,win); + + it_before = g_list_find(stacking_list, win)->prev; + if (!it_before) + wins[0] = focus_backup; + else + wins[0] = window_top(it_before->data); + wins[1] = window_top(win); + + XRestackWindows(ob_display, wins, 2); + } } }