summaryrefslogtreecommitdiff
path: root/openbox/client.c
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2003-04-24 03:41:30 +0000
committerDana Jansens <danakj@orodu.net>2003-04-24 03:41:30 +0000
commit019c779f7d3c2143ed6afe78b13f08387af3a2a2 (patch)
treed0b21718b13475d03a992b2f19fa97070ae51ffa /openbox/client.c
parent957ffe9c037f8fe005c93ddc4a7fd309e22c7fba (diff)
some more checks for transients looping on eachother when they are transients of a group
Diffstat (limited to 'openbox/client.c')
-rw-r--r--openbox/client.c50
1 files changed, 33 insertions, 17 deletions
diff --git a/openbox/client.c b/openbox/client.c
index 996c6b88..2fcbd003 100644
--- a/openbox/client.c
+++ b/openbox/client.c
@@ -665,22 +665,24 @@ void client_update_transient_for(Client *self)
Window t = None;
Client *c = NULL;
- if (XGetTransientForHint(ob_display, self->window, &t) &&
- t != self->window) { /* cant be transient to itself! */
+ if (XGetTransientForHint(ob_display, self->window, &t)) {
self->transient = TRUE;
- c = g_hash_table_lookup(client_map, &t);
- g_assert(c != self);/* if this happens then we need to check for it*/
-
- if (!c && self->group) {
- /* not transient to a client, see if it is transient for a
- group */
- if (t == self->group->leader ||
- t == None ||
- t == ob_root) {
- /* window is a transient for its group! */
- c = TRAN_GROUP;
- }
- }
+ if (t != self->window) { /* cant be transient to itself! */
+ c = g_hash_table_lookup(client_map, &t);
+ /* if this happens then we need to check for it*/
+ g_assert(c != self);
+
+ if (!c && self->group) {
+ /* not transient to a client, see if it is transient for a
+ group */
+ if (t == self->group->leader ||
+ t == None ||
+ t == ob_root) {
+ /* window is a transient for its group! */
+ c = TRAN_GROUP;
+ }
+ }
+ }
} else
self->transient = FALSE;
@@ -691,7 +693,8 @@ void client_update_transient_for(Client *self)
/* remove from old parents */
for (it = self->group->members; it; it = it->next)
- if (it->data != self)
+ if (it->data != self &&
+ (((Client*)it->data)->transient_for != TRAN_GROUP))
((Client*)it->data)->transients =
g_slist_remove(((Client*)it->data)->transients, self);
} else if (self->transient_for != NULL) { /* transient of window */
@@ -705,9 +708,22 @@ void client_update_transient_for(Client *self)
/* add to new parents */
for (it = self->group->members; it; it = it->next)
- if (it->data != self)
+ if (it->data != self &&
+ (((Client*)it->data)->transient_for != TRAN_GROUP))
((Client*)it->data)->transients =
g_slist_append(((Client*)it->data)->transients, self);
+
+ /* remove all transients which are in the group, that causes
+ circlular pointer hell of doom */
+ for (it = self->group->members; it; it = it->next) {
+ GSList *sit, *next;
+ for (sit = self->transients; sit; sit = next) {
+ next = sit->next;
+ if (sit->data == it->data)
+ self->transients = g_slist_remove(self->transients,
+ sit->data);
+ }
+ }
} else if (self->transient_for != NULL) { /* transient of window */
/* add to new parent */
self->transient_for->transients =