return;
}
- layout_t l = ACTUAL_LAYOUT(d);
-
xcb_rectangle_t rect = m->rectangle;
rect.x += m->padding.left + d->padding.left;
rect.width -= m->padding.left + d->padding.left + d->padding.right + m->padding.right;
rect.height -= m->padding.top + d->padding.top + d->padding.bottom + m->padding.bottom;
- if (l == LAYOUT_MONOCLE) {
+ if (d->layout == LAYOUT_MONOCLE) {
rect.x += monocle_padding.left;
rect.y += monocle_padding.top;
rect.width -= monocle_padding.left + monocle_padding.right;
rect.height -= monocle_padding.top + monocle_padding.bottom;
}
- if (!gapless_monocle || l != LAYOUT_MONOCLE) {
+ if (!gapless_monocle || d->layout != LAYOUT_MONOCLE) {
rect.x += d->window_gap;
rect.y += d->window_gap;
rect.width -= d->window_gap;
rect.height -= d->window_gap;
}
- apply_layout(m, d, d->root, l, rect, rect);
+ apply_layout(m, d, d->root, rect, rect);
}
-void apply_layout(monitor_t *m, desktop_t *d, node_t *n, layout_t l, xcb_rectangle_t rect, xcb_rectangle_t root_rect)
+void apply_layout(monitor_t *m, desktop_t *d, node_t *n, xcb_rectangle_t rect, xcb_rectangle_t root_rect)
{
if (n == NULL) {
return;
}
unsigned int bw;
- if ((borderless_monocle && l == LAYOUT_MONOCLE && IS_TILED(n->client))
+ if ((borderless_monocle && d->layout == LAYOUT_MONOCLE && IS_TILED(n->client))
|| n->client->state == STATE_FULLSCREEN) {
bw = 0;
} else {
client_state_t s = n->client->state;
/* tiled and pseudo-tiled clients */
if (s == STATE_TILED || s == STATE_PSEUDO_TILED) {
- int wg = (gapless_monocle && l == LAYOUT_MONOCLE ? 0 : d->window_gap);
+ int wg = (gapless_monocle && d->layout == LAYOUT_MONOCLE ? 0 : d->window_gap);
r = rect;
int bleed = wg + 2 * bw;
r.width = (bleed < r.width ? r.width - bleed : 1);
xcb_rectangle_t first_rect;
xcb_rectangle_t second_rect;
- if (l == LAYOUT_MONOCLE || n->first_child->vacant || n->second_child->vacant) {
+ if (d->layout == LAYOUT_MONOCLE || n->first_child->vacant || n->second_child->vacant) {
first_rect = second_rect = rect;
} else {
unsigned int fence;
}
}
- apply_layout(m, d, n->first_child, l, first_rect, root_rect);
- apply_layout(m, d, n->second_child, l, second_rect, root_rect);
+ apply_layout(m, d, n->first_child, first_rect, root_rect);
+ apply_layout(m, d, n->second_child, second_rect, root_rect);
}
}
node_t *r = make_node(XCB_NONE);
insert_node(m, d, r, n);
- put_status(SBSC_MASK_REPORT);
+ if (single_monocle && d->layout == LAYOUT_MONOCLE && tiled_count(d->root, true) > 1) {
+ set_layout(m, d, d->user_layout, false);
+ }
}
bool activate_node(monitor_t *m, desktop_t *d, node_t *n)
}
free_node(n);
+ if (single_monocle && d->layout != LAYOUT_MONOCLE && tiled_count(d->root, true) <= 1) {
+ set_layout(m, d, LAYOUT_MONOCLE, false);
+ }
+
ewmh_update_client_list(false);
ewmh_update_client_list(true);
show_node(d1, n2);
}
+ if (single_monocle) {
+ layout_t l1 = tiled_count(d1->root, true) <= 1 ? LAYOUT_MONOCLE : d1->user_layout;
+ layout_t l2 = tiled_count(d2->root, true) <= 1 ? LAYOUT_MONOCLE : d2->user_layout;
+ set_layout(m1, d1, l1, false);
+ set_layout(m2, d2, l2, false);
+ }
+
if (n1_held_focus) {
if (d1_was_focused) {
if (follow) {
draw_border(ns, is_descendant(ns, ds->focus), (ms == mon));
}
} else {
+ if (single_monocle) {
+ if (ds->layout != LAYOUT_MONOCLE && tiled_count(ds->root, true) <= 1) {
+ set_layout(ms, ds, LAYOUT_MONOCLE, false);
+ }
+ if (dd->layout == LAYOUT_MONOCLE && tiled_count(dd->root, true) > 1) {
+ set_layout(md, dd, dd->user_layout, false);
+ }
+ }
if (held_focus) {
if (follow) {
if (ds_was_focused) {
client_t *c = n->client;
+ bool was_tiled = IS_TILED(c);
+
c->last_state = c->state;
c->state = s;
put_status(SBSC_MASK_REPORT);
}
+ if (single_monocle && was_tiled != IS_TILED(c)) {
+ if (was_tiled && d->layout != LAYOUT_MONOCLE && tiled_count(d->root, true) <= 1) {
+ set_layout(m, d, LAYOUT_MONOCLE, false);
+ } else if (!was_tiled && d->layout == LAYOUT_MONOCLE && tiled_count(d->root, true) > 1) {
+ set_layout(m, d, d->user_layout, false);
+ }
+ }
+
return true;
}
return c->tiled_rectangle;
}
} else {
- int wg = (d == NULL ? 0 : (gapless_monocle && IS_MONOCLE(d) ? 0 : d->window_gap));
+ int wg = (d == NULL ? 0 : (gapless_monocle && d->layout == LAYOUT_MONOCLE ? 0 : d->window_gap));
xcb_rectangle_t rect = n->rectangle;
rect.width -= wg;
rect.height -= wg;