+ if (n == NULL)
+ return;
+
+ n->rectangle = rect;
+
+ if (is_leaf(n)) {
+
+ unsigned int bw;
+ if ((borderless_monocle && is_tiled(n->client) &&
+ !n->client->pseudo_tiled &&
+ d->layout == LAYOUT_MONOCLE) ||
+ n->client->fullscreen)
+ bw = 0;
+ else
+ bw = n->client->border_width;
+
+ xcb_rectangle_t r;
+ if (!n->client->fullscreen) {
+ if (!n->client->floating) {
+ int wg = (gapless_monocle && d->layout == LAYOUT_MONOCLE ? 0 : d->window_gap);
+ if (n->client->pseudo_tiled) {
+ /* pseudo-tiled clients */
+ 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;
+ }
+ } else {
+ /* tiled clients */
+ 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);
+ }
+ n->client->tiled_rectangle = r;
+ } else {
+ /* floating clients */
+ r = n->client->floating_rectangle;
+ }
+ } else {
+ /* fullscreen clients */
+ r = m->rectangle;
+ }
+
+ window_move_resize(n->client->window, r.x, r.y, r.width, r.height);
+ window_border_width(n->client->window, bw);
+ window_draw_border(n, d->focus == n, m == mon);
+
+ if (pointer_follows_focus && mon->desk->focus == n && frozen_pointer->action == ACTION_NONE) {
+ center_pointer(r);
+ }
+
+ } 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);
+ }