X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=openbox%2Fstacking.c;h=275cd572bc1395b7f55535da60dac167bae30669;hb=fc32577766755a84ac883b4d862fab3c5e681642;hp=be6d07d6daaa0d0a590da95eb97c5ebb18d0615b;hpb=88097ba46cf4003f62effdc8b3aea64cdce6479f;p=chaz%2Fopenbox diff --git a/openbox/stacking.c b/openbox/stacking.c index be6d07d6..275cd572 100644 --- a/openbox/stacking.c +++ b/openbox/stacking.c @@ -2,6 +2,7 @@ #include "prop.h" #include "focus.h" #include "client.h" +#include "group.h" #include "frame.h" #include @@ -13,12 +14,18 @@ void stacking_set_list() GList *it; guint size = g_list_length(stacking_list); + /* on shutdown, don't update the properties, so that we can read it back + in on startup and re-stack the windows as they were before we shut down + */ + if (ob_state == State_Exiting) return; + /* create an array of the window ids (from bottom to top, reverse order!) */ if (size > 0) { windows = g_new(Window, size); win_it = windows; - for (it = g_list_last(stacking_list); it != NULL; it = it->prev, ++win_it) + for (it = g_list_last(stacking_list); it != NULL; + it = it->prev, ++win_it) *win_it = ((Client*)it->data)->window; } else windows = NULL; @@ -79,12 +86,27 @@ void stacking_lower(Client *client) g_assert(stacking_list != NULL); /* this would be bad */ - it = g_list_last(stacking_list); - if (client->modal && client->transient_for) { - /* don't let a modal window lower below its transient_for */ - it = g_list_find(stacking_list, client->transient_for); - g_assert(it != NULL); + if (client->transient_for == TRAN_GROUP) { + /* don't let a modal of the group lower below any other windows + in the group */ + for (it = stacking_list; it; it = it->next) { + GSList *sit; + Client *c = it->data; + + if (it->data == client) continue; + + for (sit = c->group->members; sit; sit = sit->next) + if (sit->data == it->data) break; + if (sit) break; /* got it */ + } + if (it == NULL) + goto lower_no_parent; + } else { + /* don't let a modal window lower below its transient_for */ + it = g_list_find(stacking_list, client->transient_for); + } + g_assert(it != NULL); wins[0] = (it == stacking_list ? focus_backup : ((Client*)it->prev->data)->frame->window); @@ -94,9 +116,13 @@ void stacking_lower(Client *client) stacking_list = g_list_remove(stacking_list, client); stacking_list = g_list_insert_before(stacking_list, it, client); } else { + lower_no_parent: + + it = g_list_last(stacking_list); + while (it != stacking_list) { Client *c = it->data; - if (client->layer >= c->layer) + if (client->layer <= c->layer) break; it = it->prev; }