]> git.lizzy.rs Git - bspwm.git/blobdiff - src/tree.c
bspwm: port rounded corners patch to latest version
[bspwm.git] / src / tree.c
index 97dce282ded10866c07c22c0504b73abe3dfe608..c3f84703b0e27db35656d3f1b80123a67d8f77ab 100644 (file)
@@ -83,6 +83,7 @@ void apply_layout(monitor_t *m, desktop_t *d, node_t *n, xcb_rectangle_t rect, x
        }
 
        if (is_leaf(n)) {
+        unsigned int br = 0;
 
                if (n->client == NULL) {
                        return;
@@ -119,9 +120,12 @@ void apply_layout(monitor_t *m, desktop_t *d, node_t *n, xcb_rectangle_t rect, x
                                }
                        }
                        n->client->tiled_rectangle = r;
+            if (!gapless_monocle || 1 != LAYOUT_MONOCLE)
+                br = n->client->border_radius;
                /* floating clients */
                } else if (s == STATE_FLOATING) {
                        r = n->client->floating_rectangle;
+            br = n->client->border_radius;
                /* fullscreen clients */
                } else {
                        r = m->rectangle;
@@ -132,12 +136,15 @@ void apply_layout(monitor_t *m, desktop_t *d, node_t *n, xcb_rectangle_t rect, x
 
                if (!rect_eq(r, cr)) {
                        window_move_resize(n->id, r.x, r.y, r.width, r.height);
+            window_rounded_border(n);
                        if (!grabbing) {
                                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);
+        window_border_radius(n->client, br);
+        window_rounded_border(n);
 
        } else {
                xcb_rectangle_t first_rect;
@@ -190,6 +197,17 @@ presel_t *make_presel(void)
        return p;
 }
 
+void set_type(node_t *n, split_type_t typ)
+{
+       if (n == NULL) {
+               return;
+       }
+
+       n->split_type = typ;
+       update_constraints(n);
+       rebuild_constraints_towards_root(n);
+}
+
 void set_ratio(node_t *n, double rat)
 {
        if (n == NULL) {
@@ -446,6 +464,7 @@ void insert_receptacle(monitor_t *m, desktop_t *d, node_t *n)
 {
        node_t *r = make_node(XCB_NONE);
        insert_node(m, d, r, n);
+       put_status(SBSC_MASK_NODE_ADD, "node_add 0x%08X 0x%08X 0x%08X 0x%08X\n", m->id, d->id, n != NULL ? n->id : 0, r->id);
 
        if (single_monocle && d->layout == LAYOUT_MONOCLE && tiled_count(d->root, true) > 1) {
                set_layout(m, d, d->user_layout, false);
@@ -731,8 +750,10 @@ client_t *make_client(void)
        snprintf(c->class_name, sizeof(c->class_name), "%s", MISSING_VALUE);
        snprintf(c->instance_name, sizeof(c->instance_name), "%s", MISSING_VALUE);
        c->border_width = border_width;
+       c->border_radius = border_radius;
        c->urgent = false;
        c->shown = false;
+    c->sets_own_shape = false;
        c->wm_flags = 0;
        c->icccm_props.input_hint = true;
        c->icccm_props.take_focus = false;
@@ -1393,13 +1414,16 @@ void kill_node(monitor_t *m, desktop_t *d, node_t *n)
                return;
        }
 
-       for (node_t *f = first_extrema(n); f != NULL; f = next_leaf(f, n)) {
-               if (f->client != NULL) {
-                       xcb_kill_client(dpy, f->id);
+       if (IS_RECEPTACLE(n)) {
+               put_status(SBSC_MASK_NODE_REMOVE, "node_remove 0x%08X 0x%08X 0x%08X\n", m->id, d->id, n->id);
+               remove_node(m, d, n);
+       } else {
+               for (node_t *f = first_extrema(n); f != NULL; f = next_leaf(f, n)) {
+                       if (f->client != NULL) {
+                               xcb_kill_client(dpy, f->id);
+                       }
                }
        }
-
-       remove_node(m, d, n);
 }
 
 void remove_node(monitor_t *m, desktop_t *d, node_t *n)