+ if (n == NULL) {
+ return;
+ }
+
+ n->rectangle = rect;
+
+ if (pointer_follows_focus && mon->desk->focus == n && frozen_pointer->action == ACTION_NONE) {
+ xcb_rectangle_t r = rect;
+ r.width -= d->window_gap;
+ r.height -= d->window_gap;
+ center_pointer(r);
+ }
+
+ if (n->presel != NULL) {
+ draw_presel_feedback(m, d, n);
+ }
+
+ if (is_leaf(n)) {
+
+ if (n->client == NULL) {
+ return;
+ }
+
+ unsigned int bw;
+ if ((borderless_monocle && n->client->state == STATE_TILED && d->layout == LAYOUT_MONOCLE)
+ || n->client->state == STATE_FULLSCREEN) {
+ bw = 0;
+ } else {
+ bw = n->client->border_width;
+ }
+
+ xcb_rectangle_t r;
+ xcb_rectangle_t cr = get_rectangle(d, n);
+ client_state_t s = n->client->state;
+ if (s == STATE_TILED || s == STATE_PSEUDO_TILED) {
+ int wg = (gapless_monocle && d->layout == LAYOUT_MONOCLE ? 0 : d->window_gap);
+ /* tiled clients */
+ if (s == STATE_TILED) {
+ r = rect;
+ int bleed = wg + 2 * bw;
+ r.width = (bleed < r.width ? r.width - bleed : 1);
+ r.height = (bleed < r.height ? r.height - bleed : 1);
+ /* pseudo-tiled clients */
+ } else {
+ r = n->client->floating_rectangle;
+ if (center_pseudo_tiled) {
+ r.x = rect.x - bw + (rect.width - wg - r.width) / 2;
+ r.y = rect.y - bw + (rect.height - wg - r.height) / 2;
+ } else {
+ r.x = rect.x;
+ r.y = rect.y;
+ }
+ }
+ n->client->tiled_rectangle = r;
+ /* floating clients */
+ } else if (s == STATE_FLOATING) {
+ r = n->client->floating_rectangle;
+ /* fullscreen clients */
+ } else {
+ r = m->rectangle;
+ }
+
+ if (!rect_eq(r, cr)) {
+ window_move_resize(n->id, r.x, r.y, r.width, r.height);
+ if (frozen_pointer->action == ACTION_NONE) {
+ put_status(SBSC_MASK_NODE_GEOMETRY, "node_geometry 0x%08X 0x%08X 0x%08X %ux%u+%i+%i\n", m->id, d->id, n->id, r.width, r.height, r.x, r.y);
+ }
+ }
+
+ window_border_width(n->id, bw);
+
+ } else {
+ xcb_rectangle_t first_rect;
+ xcb_rectangle_t second_rect;
+
+ if (d->layout == LAYOUT_MONOCLE || n->first_child->vacant || n->second_child->vacant) {
+ first_rect = second_rect = rect;
+ } else {
+ unsigned int fence;
+ if (n->split_type == TYPE_VERTICAL) {
+ fence = rect.width * n->split_ratio;
+ first_rect = (xcb_rectangle_t) {rect.x, rect.y, fence, rect.height};
+ second_rect = (xcb_rectangle_t) {rect.x + fence, rect.y, rect.width - fence, rect.height};
+ } else {
+ fence = rect.height * n->split_ratio;
+ first_rect = (xcb_rectangle_t) {rect.x, rect.y, rect.width, fence};
+ second_rect = (xcb_rectangle_t) {rect.x, rect.y + fence, rect.width, rect.height - fence};
+ }
+ }
+
+ apply_layout(m, d, n->first_child, first_rect, root_rect);
+ apply_layout(m, d, n->second_child, second_rect, root_rect);
+ }
+}