summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFurkan Sahin <furkan-dev@proton.me>2018-01-12 23:12:23 -0500
committerFurkan Sahin <furkan-dev@proton.me>2018-01-12 23:12:23 -0500
commitf3395a6e4c4b04768bf6c41d3fd120bfbae1e533 (patch)
tree5c98beffeb67ac5f30aabe3aa9b5be175accefac
parent9e2d0bcc03831499beff6f4f7fb11570a55e3553 (diff)
Calculate positions of empty blocks in swaybar
-rw-r--r--swaybar/render.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/swaybar/render.c b/swaybar/render.c
index 6fc09078..e874fc86 100644
--- a/swaybar/render.c
+++ b/swaybar/render.c
@@ -97,6 +97,10 @@ static void render_block(struct window *window, struct config *config, struct st
block->x = (int)pos;
block->width = (int)block_width;
+ if (!block->full_text || !block->full_text[0]) {
+ return;
+ }
+
// render background
if (block->background != 0x0) {
cairo_set_source_u32(window->cairo, block->background);
@@ -330,10 +334,8 @@ void render(struct output *output, struct config *config, struct status_line *li
bool edge = true;
for (i = line->block_line->length - 1; i >= 0; --i) {
struct status_block *block = line->block_line->items[i];
- if (block->full_text && block->full_text[0]) {
- render_block(window, config, block, &pos, edge, is_focused);
- edge = false;
- }
+ render_block(window, config, block, &pos, edge, is_focused);
+ edge = false;
}
}