]> git.lizzy.rs Git - bspwm.git/commitdiff
single_monocle: include receptacles
authorBastien Dejean <nihilhill@gmail.com>
Tue, 17 Jul 2018 09:26:34 +0000 (11:26 +0200)
committerBastien Dejean <nihilhill@gmail.com>
Tue, 17 Jul 2018 09:26:34 +0000 (11:26 +0200)
src/helpers.h
src/tree.c
src/tree.h

index 82bad85e06aaf784af69e3e7fc5a47127ecaf872..771bbdce98f96eae7e350834a30467fecd564343 100644 (file)
@@ -40,7 +40,7 @@
 #define IS_FLOATING(c)    (c->state == STATE_FLOATING)
 #define IS_FULLSCREEN(c)  (c->state == STATE_FULLSCREEN)
 #define IS_RECEPTACLE(n)  (is_leaf(n) && n->client == NULL)
-#define IS_MONOCLE(d)     (d->layout == LAYOUT_MONOCLE || (single_monocle && tiled_count(d->root) <= 1))
+#define IS_MONOCLE(d)     (d->layout == LAYOUT_MONOCLE || (single_monocle && tiled_count(d->root, true) <= 1))
 
 #define BOOL_STR(A)       ((A) ? "true" : "false")
 #define ON_OFF_STR(A)     ((A) ? "on" : "off")
index 4e9929f003df1d6dbe8060f720180b5ea6c02313..93993bdbd4bcefde86e4188b43e08c1feef5db65 100644 (file)
@@ -48,7 +48,7 @@ void arrange(monitor_t *m, desktop_t *d)
 
        layout_t l = d->layout;
 
-       if (single_monocle && tiled_count(d->root) <= 1) {
+       if (single_monocle && tiled_count(d->root, true) <= 1) {
                l = LAYOUT_MONOCLE;
        }
 
@@ -1029,14 +1029,15 @@ unsigned int node_area(desktop_t *d, node_t *n)
        return area(get_rectangle(NULL, d, n));
 }
 
-int tiled_count(node_t *n)
+int tiled_count(node_t *n, bool include_receptacles)
 {
        if (n == NULL) {
                return 0;
        }
        int cnt = 0;
        for (node_t *f = first_extrema(n); f != NULL; f = next_leaf(f, n)) {
-               if (!f->hidden && f->client != NULL && IS_TILED(f->client)) {
+               if (!f->hidden && ((include_receptacles && f->client == NULL) ||
+                                  (f->client != NULL && IS_TILED(f->client)))) {
                        cnt++;
                }
        }
@@ -1559,7 +1560,7 @@ bool find_closest_node(coordinates_t *ref, coordinates_t *dst, cycle_dir_t dir,
 
 void circulate_leaves(monitor_t *m, desktop_t *d, node_t *n, circulate_dir_t dir)
 {
-       if (tiled_count(n) < 2) {
+       if (tiled_count(n, false) < 2) {
                return;
        }
        node_t *p = d->focus->parent;
index 8e0293a01bcb484f4cf4be515528a0ebb0bf62fd..8c82b24889a6feaa072a099f4ec923075a6c0c06 100644 (file)
@@ -70,7 +70,7 @@ void find_any_node(coordinates_t *ref, coordinates_t *dst, node_select_t *sel);
 bool find_any_node_in(monitor_t *m, desktop_t *d, node_t *n, coordinates_t *ref, coordinates_t *dst, node_select_t *sel);
 void find_nearest_neighbor(coordinates_t *ref, coordinates_t *dst, direction_t dir, node_select_t *sel);
 unsigned int node_area(desktop_t *d, node_t *n);
-int tiled_count(node_t *n);
+int tiled_count(node_t *n, bool include_receptacles);
 void find_by_area(area_peak_t ap, coordinates_t *ref, coordinates_t *dst, node_select_t *sel);
 void rotate_tree(node_t *n, int deg);
 void rotate_tree_rec(node_t *n, int deg);