diff options
author | Nathan Schulte <[email protected]> | 2021-09-15 05:07:07 -0500 |
---|---|---|
committer | Simon Ser <[email protected]> | 2021-09-20 09:53:32 +0200 |
commit | 033061aee602a54f65340e2a300054d2790c22ea (patch) | |
tree | 79aa689ba0523caeecd25e8d20320d60de8632b0 /swaybar/render.c | |
parent | a3451805200cd63ffe7478288a6d9b410cdaee35 (diff) |
swaybar: properly draw blocks with transparent black border
while the draw itself is a no-op, alignment must still be accounted
this requires more signalling about the blocks (border_set; was the
border set?)
Diffstat (limited to 'swaybar/render.c')
-rw-r--r-- | swaybar/render.c | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/swaybar/render.c b/swaybar/render.c index 65cacd39..92b73f4c 100644 --- a/swaybar/render.c +++ b/swaybar/render.c @@ -14,6 +14,7 @@ #include "swaybar/ipc.h" #include "swaybar/render.h" #include "swaybar/status_line.h" +#include "log.h" #if HAVE_TRAY #include "swaybar/tray/tray.h" #endif @@ -215,11 +216,11 @@ static uint32_t render_status_block(struct render_context *ctx, } *x -= width; - if ((block->border || block->urgent) && block->border_left > 0) { + if ((block->border_set || block->urgent) && block->border_left > 0) { *x -= (block->border_left + margin); block_width += block->border_left + margin; } - if ((block->border || block->urgent) && block->border_right > 0) { + if ((block->border_set || block->urgent) && block->border_right > 0) { *x -= (block->border_right + margin); block_width += block->border_right + margin; } @@ -273,18 +274,20 @@ static uint32_t render_status_block(struct render_context *ctx, uint32_t border_color = block->urgent ? config->colors.urgent_workspace.border : block->border; - if (border_color && block->border_top > 0) { - render_sharp_line(cairo, border_color, x_pos, y_pos, - block_width, block->border_top); - } - if (border_color && block->border_bottom > 0) { - render_sharp_line(cairo, border_color, x_pos, - y_pos + render_height - block->border_bottom, - block_width, block->border_bottom); - } - if (border_color && block->border_left > 0) { - render_sharp_line(cairo, border_color, x_pos, y_pos, - block->border_left, render_height); + if (block->border_set || block->urgent) { + if (block->border_top > 0) { + render_sharp_line(cairo, border_color, x_pos, y_pos, + block_width, block->border_top); + } + if (block->border_bottom > 0) { + render_sharp_line(cairo, border_color, x_pos, + y_pos + render_height - block->border_bottom, + block_width, block->border_bottom); + } + if (block->border_left > 0) { + render_sharp_line(cairo, border_color, x_pos, y_pos, + block->border_left, render_height); + } x_pos += block->border_left + margin; } @@ -307,10 +310,12 @@ static uint32_t render_status_block(struct render_context *ctx, render_text(cairo, config->font, 1, block->markup, "%s", text); x_pos += width; - if (border_color && block->border_right > 0) { + if (block->border_set || block->urgent) { x_pos += margin; - render_sharp_line(cairo, border_color, x_pos, y_pos, - block->border_right, render_height); + if (block->border_right > 0) { + render_sharp_line(cairo, border_color, x_pos, y_pos, + block->border_right, render_height); + } x_pos += block->border_right; } @@ -375,10 +380,10 @@ static void predict_status_block_pos(cairo_t *cairo, } *x -= width; - if ((block->border || block->urgent) && block->border_left > 0) { + if ((block->border_set || block->urgent) && block->border_left > 0) { *x -= (block->border_left + margin); } - if ((block->border || block->urgent) && block->border_right > 0) { + if ((block->border_set || block->urgent) && block->border_right > 0) { *x -= (block->border_right + margin); } |