- xcb_copy_area(conn, parent->pixmap, parent->frame, parent->pm_gc, 0, 0, 0, 0, parent->rect.width, parent->rect.height);
+}
+
+/*
+ * Recursively calls x_draw_decoration. This cannot be done in x_push_node
+ * because x_push_node uses focus order to recurse (see the comment above)
+ * while drawing the decoration needs to happen in the actual order.
+ *
+ */
+void x_deco_recurse(Con *con) {
+ Con *current;
+ bool leaf = TAILQ_EMPTY(&(con->nodes_head)) &&
+ TAILQ_EMPTY(&(con->floating_head));
+ con_state *state = state_for_frame(con->frame);
+
+ if (!leaf) {
+ TAILQ_FOREACH(current, &(con->nodes_head), nodes)
+ x_deco_recurse(current);
+
+ TAILQ_FOREACH(current, &(con->floating_head), floating_windows)
+ x_deco_recurse(current);
+
+ if (state->mapped)
+ xcb_copy_area(conn, con->pixmap, con->frame, con->pm_gc, 0, 0, 0, 0, con->rect.width, con->rect.height);
+ }
+
+ if ((con->type != CT_ROOT && con->type != CT_OUTPUT) &&
+ (!leaf || con->mapped))
+ x_draw_decoration(con);