From 57e3ce37f3feea19c6e3acb2c63a7391097a05ee Mon Sep 17 00:00:00 2001 From: Guido Cella Date: Thu, 27 Aug 2020 08:39:26 +0200 Subject: [PATCH] Allow borderpx=0 Avoids crashing with the error dwl: render/wlr_renderer.c:102: wlr_render_rect: Assertion `box->width > 0 && box->height > 0' failed. --- dwl.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/dwl.c b/dwl.c index 730e46a..d1ec865 100644 --- a/dwl.c +++ b/dwl.c @@ -1184,19 +1184,21 @@ renderclients(Monitor *m, struct timespec *now) &ox, &oy); w = surface->current.width; h = surface->current.height; - borders = (struct wlr_box[4]) { - {ox, oy, w + 2 * c->bw, c->bw}, /* top */ - {ox, oy + c->bw, c->bw, h}, /* left */ - {ox + c->bw + w, oy + c->bw, c->bw, h}, /* right */ - {ox, oy + c->bw + h, w + 2 * c->bw, c->bw}, /* bottom */ - }; + if (c->bw) { + borders = (struct wlr_box[4]) { + {ox, oy, w + 2 * c->bw, c->bw}, /* top */ + {ox, oy + c->bw, c->bw, h}, /* left */ + {ox + c->bw + w, oy + c->bw, c->bw, h}, /* right */ + {ox, oy + c->bw + h, w + 2 * c->bw, c->bw}, /* bottom */ + }; - /* Draw window borders */ - color = (c == sel) ? focuscolor : bordercolor; - for (i = 0; i < 4; i++) { - scalebox(&borders[i], m->wlr_output->scale); - wlr_render_rect(drw, &borders[i], color, - m->wlr_output->transform_matrix); + /* Draw window borders */ + color = (c == sel) ? focuscolor : bordercolor; + for (i = 0; i < 4; i++) { + scalebox(&borders[i], m->wlr_output->scale); + wlr_render_rect(drw, &borders[i], color, + m->wlr_output->transform_matrix); + } } /* This calls our render function for each surface among the