- KWin 3.0 will not consider windows with transient_for set to
- Root as transient for their group *UNLESS* they are also modal.
- In that case, it will make them transient for the group. This
- leads to all sorts of weird behavior from KDE apps which are
- only tested in KWin. I'd like to follow their behavior just to
- make this work right with KDE stuff, but that seems wrong.
- */
- if (!target && self->group) {
- /* not transient to a client, see if it is transient for a
- group */
- if (t == RootWindow(ob_display, ob_screen)) {
- /* window is a transient for its group! */
- target = OB_TRAN_GROUP;
- }
- }
- }
- } else if (self->group) {
- if (self->type == OB_CLIENT_TYPE_DIALOG ||
- self->type == OB_CLIENT_TYPE_TOOLBAR ||
- self->type == OB_CLIENT_TYPE_MENU ||
- self->type == OB_CLIENT_TYPE_UTILITY)
- {
- self->transient = TRUE;
- target = OB_TRAN_GROUP;
- }
- } else
- self->transient = FALSE;
-
- /* if anything has changed... */
- if (target != self->transient_for) {
- if (self->transient_for == OB_TRAN_GROUP) { /* transient of group */
- GSList *it;
-
- /* remove from old parents */
- for (it = self->group->members; it; it = g_slist_next(it)) {
- ObClient *c = it->data;
- if (c != self && (!c->transient_for ||
- c->transient_for != OB_TRAN_GROUP))
- c->transients = g_slist_remove(c->transients, self);
- }
- } else if (self->transient_for != NULL) { /* transient of window */
- /* remove from old parent */
- self->transient_for->transients =
- g_slist_remove(self->transient_for->transients, self);
- }
- self->transient_for = target;
- if (self->transient_for == OB_TRAN_GROUP) { /* transient of group */
- GSList *it;
-
- /* add to new parents */
- for (it = self->group->members; it; it = g_slist_next(it)) {
- ObClient *c = it->data;
- if (c != self && (!c->transient_for ||
- c->transient_for != OB_TRAN_GROUP))
- c->transients = g_slist_append(c->transients, self);
- }
+static void client_update_transient_tree(ObClient *self,
+ ObGroup *oldgroup, ObGroup *newgroup,
+ gboolean oldgtran, gboolean newgtran,
+ ObClient* oldparent,
+ ObClient *newparent)
+{
+ GSList *it, *next;
+ ObClient *c;
+
+ g_assert(!oldgtran || oldgroup);
+ g_assert(!newgtran || newgroup);
+ g_assert((!oldgtran && !oldparent) ||
+ (oldgtran && !oldparent) ||
+ (!oldgtran && oldparent));
+ g_assert((!newgtran && !newparent) ||
+ (newgtran && !newparent) ||
+ (!newgtran && newparent));
+
+ /* * *
+ Group transient windows are not allowed to have other group
+ transient windows as their children.
+ * * */
+
+
+ /* No change has occured */
+ if (oldgroup == newgroup &&
+ oldgtran == newgtran &&
+ oldparent == newparent) return;
+
+ /** Remove the client from the transient tree **/
+
+ for (it = self->transients; it; it = next) {
+ next = g_slist_next(it);
+ c = it->data;
+ self->transients = g_slist_delete_link(self->transients, it);
+ c->parents = g_slist_remove(c->parents, self);
+ }
+ for (it = self->parents; it; it = next) {
+ next = g_slist_next(it);
+ c = it->data;
+ self->parents = g_slist_delete_link(self->parents, it);
+ c->transients = g_slist_remove(c->transients, self);
+ }