]> Dogcows Code - chaz/openbox/blobdiff - openbox/client.c
when restoring from show-desktop mode because a window is going to be focused, then...
[chaz/openbox] / openbox / client.c
index 4be855f496031d2613660052bb0bdb130f3cb1c7..3ebcc69ae8f568a0d6c5deafb129b464f8763ec8 100644 (file)
@@ -930,7 +930,9 @@ static void client_get_all(ObClient *self)
     client_get_state(self);
 
     client_update_wmhints(self);
-    client_update_transient_for(self);
+    /* this may have already been called from client_update_wmhints */
+    if (self->transient_for == NULL)
+        client_update_transient_for(self);
     client_get_startup_id(self);
     client_get_desktop(self);/* uses transient data/group/startup id if a
                                 desktop is not specified */
@@ -1177,15 +1179,14 @@ void client_update_transient_for(ObClient *self)
                 }
             }
         }
-    } 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;
+    } else 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;
+        if (self->group)
             target = OB_TRAN_GROUP;
-        }
     } else
         self->transient = FALSE;
 
@@ -1208,6 +1209,17 @@ static void client_update_transient_tree(ObClient *self,
 
     /** Remove the client from the transient tree wherever it has changed **/
 
+    /* If the window is becoming a direct transient for a window in its group
+       then that window can't be a child of this window anymore */
+    if (oldparent != newparent &&
+        newparent != NULL && newparent != OB_TRAN_GROUP &&
+        newparent->transient_for == OB_TRAN_GROUP &&
+        newgroup != NULL && newgroup == oldgroup)
+    {
+        self->transients = g_slist_remove(self->transients, newparent);
+    }
+            
+
     /* If the group changed then we need to remove any old group transient
        windows from our children. But if we're transient for the group, then
        other group transients are not our children. */
@@ -1253,7 +1265,7 @@ static void client_update_transient_tree(ObClient *self,
             c = it->data;
             if (c != self && (!c->transient_for ||
                               c->transient_for != OB_TRAN_GROUP))
-                c->transients = g_slist_prepend(c->transients, self);
+                c->transients = g_slist_append(c->transients, self);
         }
     }
     /* If we are now transient for a single window which we weren't before,
@@ -1263,12 +1275,12 @@ static void client_update_transient_tree(ObClient *self,
        transient for eachother.
     */
     else if (newparent != NULL && newparent != OB_TRAN_GROUP &&
-             newparent != newparent &&
+             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);
+        newparent->transients = g_slist_append(newparent->transients, self);
 
-    /* If the group changed then we need to add any old group transient
+    /* 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.
 
@@ -1285,7 +1297,7 @@ static void client_update_transient_tree(ObClient *self,
                 /* 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);
+                self->transients = g_slist_append(self->transients, c);
             }
         }
     }
@@ -1681,7 +1693,6 @@ void client_reconfigure(ObClient *self)
 void client_update_wmhints(ObClient *self)
 {
     XWMHints *hints;
-    GSList *it;
 
     /* assume a window takes input if it doesnt specify */
     self->can_focus = TRUE;
@@ -1752,7 +1763,7 @@ void client_update_wmhints(ObClient *self)
             */
             if (self->transient &&
                 ((self->transient_for == NULL && oldgroup == NULL) ||
-                 self->transient_for == OB_TRAN_GROUP && self->group == NULL))
+                 (self->transient_for == OB_TRAN_GROUP && !self->group)))
                 client_update_transient_for(self);
         }
 
@@ -3250,7 +3261,7 @@ void client_activate(ObClient *self, gboolean here, gboolean user)
         event_halt_focus_delay();
 
         if (client_normal(self) && screen_showing_desktop)
-            screen_show_desktop(FALSE);
+            screen_show_desktop(FALSE, FALSE);
         if (self->iconic)
             client_iconify(self, FALSE, here);
         if (self->desktop != DESKTOP_ALL &&
This page took 0.023745 seconds and 4 git commands to generate.