From 1a0d367f227fddd026ddf2a1bd21c5edbb111b00 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Tue, 10 Apr 2018 16:08:08 +1000 Subject: [PATCH 1/2] Fix swaybar not showing all status blocks. --- swaybar/render.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/swaybar/render.c b/swaybar/render.c index 28296f311..8681532a1 100644 --- a/swaybar/render.c +++ b/swaybar/render.c @@ -154,15 +154,14 @@ static uint32_t render_status_block(cairo_t *cairo, block_width += block->border_right + margin; } - int sep_width; + int sep_width, sep_height; if (!edge) { if (config->sep_symbol) { - int _height; - get_text_size(cairo, config->font, &sep_width, &_height, + get_text_size(cairo, config->font, &sep_width, &sep_height, output->scale, false, "%s", config->sep_symbol); - uint32_t _ideal_height = _height + ws_vertical_padding * 2; - if ((uint32_t)_height < _ideal_height / output->scale) { - return _height / output->scale; + uint32_t _ideal_height = sep_height + ws_vertical_padding * 2; + if (_ideal_height * output->scale > height) { + return _ideal_height; } if (sep_width > block->separator_block_width) { block->separator_block_width = sep_width + margin * 2; @@ -240,7 +239,7 @@ static uint32_t render_status_block(cairo_t *cairo, } if (config->sep_symbol) { offset = pos + (block->separator_block_width - sep_width) / 2; - cairo_move_to(cairo, offset, margin); + cairo_move_to(cairo, offset, height / 2.0 - sep_height / 2.0); pango_printf(cairo, config->font, output->scale, false, "%s", config->sep_symbol); } else { From 7dfc0409ebd14f256294118ded769cf4df56e758 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Wed, 11 Apr 2018 08:34:21 +1000 Subject: [PATCH 2/2] Check height in surface local coordinates and rename some variables. --- swaybar/render.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/swaybar/render.c b/swaybar/render.c index 8681532a1..3fd8da0b3 100644 --- a/swaybar/render.c +++ b/swaybar/render.c @@ -159,9 +159,10 @@ static uint32_t render_status_block(cairo_t *cairo, if (config->sep_symbol) { get_text_size(cairo, config->font, &sep_width, &sep_height, output->scale, false, "%s", config->sep_symbol); - uint32_t _ideal_height = sep_height + ws_vertical_padding * 2; - if (_ideal_height * output->scale > height) { - return _ideal_height; + uint32_t _ideal_surface_height = ws_vertical_padding * 2 + + sep_height; + if (_ideal_surface_height > surface_height) { + return _ideal_surface_height; } if (sep_width > block->separator_block_width) { block->separator_block_width = sep_width + margin * 2;