+ if (self->transient_for) {
+ if (self->transient_for != TRAN_GROUP) {
+ return client_search_focus_tree_full(self->transient_for);
+ } else {
+ GSList *it;
+
+ for (it = self->group->members; it; it = it->next)
+ if (((Client*)it->data)->transient_for != TRAN_GROUP) {
+ Client *c;
+ if ((c = client_search_focus_tree_full(it->data)))
+ return c;
+ }
+ return NULL;
+ }
+ } else {
+ /* 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);
+ }
+}
+
+static StackLayer calc_layer(Client *self)
+{
+ StackLayer l;
+
+ if (self->fullscreen) l = Layer_Fullscreen;
+ else if (self->type == Type_Desktop) l = Layer_Desktop;
+ else if (self->type == Type_Dock) {
+ if (!self->below) l = Layer_Top;
+ else l = Layer_Normal;
+ }
+ else if (self->above) l = Layer_Above;
+ else if (self->below) l = Layer_Below;
+ else l = Layer_Normal;
+
+ return l;
+}
+
+static void calc_recursive(Client *self, Client *orig, StackLayer l,
+ gboolean raised)
+{
+ StackLayer old, own;