merge r6973-6975 from trunk
authorDana Jansens <danakj@orodu.net>
Mon, 28 May 2007 02:13:40 +0000 (02:13 +0000)
committerDana Jansens <danakj@orodu.net>
Mon, 28 May 2007 02:13:40 +0000 (02:13 +0000)
openbox/client.c
openbox/client.h

index 5c025229af84f31ddb2212cf22f4e437705915d9..37d27ab5187f5266c2d3535546a4738888e7c506 100644 (file)
@@ -498,7 +498,7 @@ void client_manage(Window window)
                is ambiguous (either the current focus target doesn't have
                a timestamp, or they are the same (we probably inherited it
                from them) */
-            else if (self->transient_for != NULL &&
+            else if (client_has_parent(self) &&
                      (!last_time || self->user_time == last_time))
             {
                 activate = FALSE;
@@ -2355,27 +2355,32 @@ ObClient *client_search_focus_tree_full(ObClient *self)
             return client_search_focus_tree_full(self->transient_for);
         } else {
             GSList *it;
-            gboolean recursed = FALSE;
         
-            for (it = self->group->members; it; it = g_slist_next(it))
-                if (!((ObClient*)it->data)->transient_for) {
-                    ObClient *c;
-                    if ((c = client_search_focus_tree_full(it->data)))
-                        return c;
-                    recursed = TRUE;
+            for (it = self->group->members; it; it = g_slist_next(it)) {
+                if (it->data != self) {
+                    ObClient *c = it->data;
+
+                    if (client_focused(c)) return c;
+                    if ((c = client_search_focus_tree(it->data))) return c;
                 }
-            if (recursed)
-                return NULL;
+            }
         }
     }
 
-    /* this function checks the whole tree, the client_search_focus_tree~
+    /* this function checks the whole tree, the client_search_focus_tree
        does not, so we need to check this window */
     if (client_focused(self))
         return self;
     return client_search_focus_tree(self);
 }
 
+gboolean client_has_parent(ObClient *self)
+{
+    return (self->transient_for &&
+            (self->transient_for != OB_TRAN_GROUP ||
+             (self->group && self->group->members->next)));
+}
+
 static ObStackingLayer calc_layer(ObClient *self)
 {
     ObStackingLayer l;
index 3d81b270cc2130f3c6279a02934cf9a1ca8a6e7a..55b684ff2d6fa3e73dd6997109f41da08135304a 100644 (file)
@@ -612,6 +612,11 @@ void client_get_type_and_transientness(ObClient *self);
 
 const ObClientIcon *client_icon(ObClient *self, gint w, gint h);
 
+/*! Return TRUE if the client is transient for some other window. Return
+  FALSE if it's not transient or there is no window for it to be
+  transient for */
+gboolean client_has_parent(ObClient *self);
+
 /*! Searches a client's direct parents for a focused window. The function does
   not check for the passed client, only for *ONE LEVEL* of its parents.
   If no focused parentt is found, NULL is returned.