- /* remove all transients which are in the group, that causes
- circlular pointer hell of doom */
- for (it = self->group->members; it; it = g_slist_next(it)) {
- GSList *sit, *next;
- for (sit = self->transients; sit; sit = next) {
- next = g_slist_next(sit);
- if (sit->data == it->data)
- self->transients =
- g_slist_delete_link(self->transients, sit);
- }
+
+ /** Re-add the client to the transient tree wherever it has changed **/
+
+ /* If we're now transient for a group and we weren't transient for it
+ before then we need to add ourselves to all our new parents */
+ if (newparent == OB_TRAN_GROUP && (oldgroup != newgroup ||
+ oldparent != newparent))
+ {
+ for (it = oldgroup->members; it; it = g_slist_next(it)) {
+ c = it->data;
+ if (c != self && (!c->transient_for ||
+ c->transient_for != OB_TRAN_GROUP))
+ c->transients = g_slist_append(c->transients, self);
+ }
+ }
+ /* If we are now transient for a single window which we weren't before,
+ we need to add ourselves to its children
+
+ WARNING: Cyclical transient ness is possible if two windows are
+ transient for eachother.
+ */
+ else if (newparent != NULL && newparent != OB_TRAN_GROUP &&
+ newparent != oldparent &&
+ /* don't make ourself its child if it is already our child */
+ !client_is_direct_child(self, newparent))
+ newparent->transients = g_slist_append(newparent->transients, self);
+
+ /* If the group changed then we need to add any new group transient
+ windows to our children. But if we're transient for the group, then
+ other group transients are not our children.
+
+ WARNING: Cyclical transient-ness is possible. For e.g. if:
+ A is transient for the group
+ B is a member of the group and transient for A
+ */
+ if (oldgroup != newgroup && newgroup != NULL &&
+ newparent != OB_TRAN_GROUP)
+ {
+ for (it = newgroup->members; it; it = g_slist_next(it)) {
+ c = it->data;
+ if (c != self && c->transient_for == OB_TRAN_GROUP &&
+ /* Don't make it our child if it is already our parent */
+ !client_is_direct_child(c, self))
+ {
+ self->transients = g_slist_append(self->transients, c);