some more checks for transients looping on eachother when they are transients of a group
This commit is contained in:
parent
957ffe9c03
commit
019c779f7d
1 changed files with 33 additions and 17 deletions
|
@ -665,22 +665,24 @@ void client_update_transient_for(Client *self)
|
||||||
Window t = None;
|
Window t = None;
|
||||||
Client *c = NULL;
|
Client *c = NULL;
|
||||||
|
|
||||||
if (XGetTransientForHint(ob_display, self->window, &t) &&
|
if (XGetTransientForHint(ob_display, self->window, &t)) {
|
||||||
t != self->window) { /* cant be transient to itself! */
|
|
||||||
self->transient = TRUE;
|
self->transient = TRUE;
|
||||||
c = g_hash_table_lookup(client_map, &t);
|
if (t != self->window) { /* cant be transient to itself! */
|
||||||
g_assert(c != self);/* if this happens then we need to check for it*/
|
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) {
|
if (!c && self->group) {
|
||||||
/* not transient to a client, see if it is transient for a
|
/* not transient to a client, see if it is transient for a
|
||||||
group */
|
group */
|
||||||
if (t == self->group->leader ||
|
if (t == self->group->leader ||
|
||||||
t == None ||
|
t == None ||
|
||||||
t == ob_root) {
|
t == ob_root) {
|
||||||
/* window is a transient for its group! */
|
/* window is a transient for its group! */
|
||||||
c = TRAN_GROUP;
|
c = TRAN_GROUP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
self->transient = FALSE;
|
self->transient = FALSE;
|
||||||
|
|
||||||
|
@ -691,7 +693,8 @@ void client_update_transient_for(Client *self)
|
||||||
|
|
||||||
/* remove from old parents */
|
/* remove from old parents */
|
||||||
for (it = self->group->members; it; it = it->next)
|
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 =
|
((Client*)it->data)->transients =
|
||||||
g_slist_remove(((Client*)it->data)->transients, self);
|
g_slist_remove(((Client*)it->data)->transients, self);
|
||||||
} else if (self->transient_for != NULL) { /* transient of window */
|
} else if (self->transient_for != NULL) { /* transient of window */
|
||||||
|
@ -705,9 +708,22 @@ void client_update_transient_for(Client *self)
|
||||||
|
|
||||||
/* add to new parents */
|
/* add to new parents */
|
||||||
for (it = self->group->members; it; it = it->next)
|
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 =
|
((Client*)it->data)->transients =
|
||||||
g_slist_append(((Client*)it->data)->transients, self);
|
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 */
|
} else if (self->transient_for != NULL) { /* transient of window */
|
||||||
/* add to new parent */
|
/* add to new parent */
|
||||||
self->transient_for->transients =
|
self->transient_for->transients =
|
||||||
|
|
Loading…
Reference in a new issue