diff --git a/src/tree.c b/src/tree.c index 9e0a6dd..49c46bc 100644 --- a/src/tree.c +++ b/src/tree.c @@ -82,6 +82,7 @@ void apply_layout(monitor_t *m, desktop_t *d, node_t *n, xcb_rectangle_t rect, x draw_presel_feedback(m, d, n); } + if (is_leaf(n)) { unsigned int br = 0; @@ -136,7 +137,7 @@ 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); + window_rounded_border(n, br); 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); } @@ -145,7 +146,7 @@ void apply_layout(monitor_t *m, desktop_t *d, node_t *n, xcb_rectangle_t rect, x window_border_width(n->id, bw); n->client->drawn_border_radius = br; - window_rounded_border(n); + window_rounded_border(n, br); } else { xcb_rectangle_t first_rect; diff --git a/src/window.c b/src/window.c index 8058fa5..1931352 100644 --- a/src/window.c +++ b/src/window.c @@ -91,6 +91,8 @@ bool manage_window(xcb_window_t win, rule_consequence_t *csq, int fd) free(csq->layer); free(csq->state); window_show(win); + node_t *n = make_node(win); + window_rounded_border(n, d->border_radius); return false; } @@ -229,7 +231,7 @@ bool manage_window(xcb_window_t win, rule_consequence_t *csq, int fd) draw_border(n, false, (m == mon)); } - window_rounded_border(n); + window_rounded_border(n, n->client->drawn_border_radius); free(csq->layer); free(csq->state); @@ -335,7 +337,7 @@ void draw_presel_feedback(monitor_t *m, desktop_t *d, node_t *n) window_move_resize(p->feedback, n->rectangle.x + presel_rect.x, n->rectangle.y + presel_rect.y, presel_rect.width, presel_rect.height); - window_rounded_border(n); + window_rounded_border(n, n->client->drawn_border_radius); if (!exists && m->desk == d) { window_show(p->feedback); @@ -429,12 +431,9 @@ void draw_border(node_t *n, bool focused_node, bool focused_monitor) } } -void window_rounded_border(node_t *n) +void window_rounded_border(node_t *n, unsigned int radius) { xcb_window_t win = n->id; - unsigned int radius = n->client->drawn_border_radius; - - if (n->client->sets_own_shape) return; // get geometry xcb_get_geometry_reply_t *geo = xcb_get_geometry_reply(dpy, xcb_get_geometry(dpy, win), NULL); @@ -720,7 +719,7 @@ bool resize_client(coordinates_t *loc, resize_handle_t rh, int dx, int dy, bool n->client->floating_rectangle = (xcb_rectangle_t) {x, y, width, height}; if (n->client->state == STATE_FLOATING) { window_move_resize(n->id, x, y, width, height); - window_rounded_border(n); + window_rounded_border(n, n->client->drawn_border_radius); if (!grabbing) { put_status(SBSC_MASK_NODE_GEOMETRY, "node_geometry 0x%08X 0x%08X 0x%08X %ux%u+%i+%i\n", loc->monitor->id, loc->desktop->id, loc->node->id, width, height, x, y); diff --git a/src/window.h b/src/window.h index 79805cb..77da863 100644 --- a/src/window.h +++ b/src/window.h @@ -44,7 +44,7 @@ void hide_presel_feedbacks(monitor_t *m, desktop_t *d, node_t *n); void update_colors(void); void update_colors_in(node_t *n, desktop_t *d, monitor_t *m); void draw_border(node_t *n, bool focused_node, bool focused_monitor); -void window_rounded_border(node_t *n); +void window_rounded_border(node_t *n, unsigned int radius); void window_draw_border(xcb_window_t win, uint32_t border_color_pxl); void adopt_orphans(void); uint32_t get_border_color(bool focused_node, bool focused_monitor);