+ /* If the window is becoming a direct transient for a window in its group
+ then any group transients which were our children and are now becoming
+ our parents need to stop being our children.
+
+ Group transients can't be children of group transients already, but
+ we could have any number of direct parents above up, any of which could
+ be transient for the group, and we need to remove it from our children.
+ */
+ if (oldparent != newparent &&
+ newparent != NULL && newparent != OB_TRAN_GROUP &&
+ newgroup != NULL && newgroup == oldgroup)
+ {
+ ObClient *look = newparent;
+ do {
+ self->transients = g_slist_remove(self->transients, look);
+ look = look->transient_for;
+ } while (look != NULL && look != OB_TRAN_GROUP);
+ }
+
+
+ /* If the group changed, or if we are just becoming transient for the
+ group, then we need to remove any old group transient windows
+ from our children. But if we were already transient for the group, then
+ other group transients are not our children. */
+ if ((oldgroup != newgroup ||
+ (newparent == OB_TRAN_GROUP && oldparent != newparent)) &&
+ oldgroup != NULL && oldparent != OB_TRAN_GROUP)
+ {
+ for (it = self->transients; it; it = next) {
+ next = g_slist_next(it);
+ c = it->data;
+ if (c->group == oldgroup)
+ self->transients = g_slist_delete_link(self->transients, it);
+ }
+ }
+
+ /* If we used to be transient for a group and now we are not, or we're
+ transient for a new group, then we need to remove ourselves from all
+ our ex-parents */
+ if (oldparent == 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_remove(c->transients, self);
+ }
+ }
+ /* If we used to be transient for a single window and we are no longer
+ transient for it, then we need to remove ourself from its children */
+ else if (oldparent != NULL && oldparent != OB_TRAN_GROUP &&
+ oldparent != newparent)
+ oldparent->transients = g_slist_remove(oldparent->transients, self);
+
+
+ /** 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_prepend(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_prepend(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 transient for A
+ C is transient for B
+ A can't be transient for C or we have a cycle
+ */
+ 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_prepend(self->transients, c);
+ }
+ }
+ }
+}
+
+static void client_get_mwm_hints(ObClient *self)
+{
+ guint num;
+ guint32 *hints;
+
+ self->mwmhints.flags = 0; /* default to none */
+
+ if (PROP_GETA32(self->window, motif_wm_hints, motif_wm_hints,