aboutsummaryrefslogtreecommitdiffstats
path: root/swaybar
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2019-01-13 20:36:08 -0500
committerLibravatar GitHub <noreply@github.com>2019-01-13 20:36:08 -0500
commitfc93cd20dc108544c7cc8fced7aebed58c58a770 (patch)
tree87eb259f5f02c6bcf5240bf677d9569ee9e72518 /swaybar
parentMerge pull request #3398 from RedSoxFan/toggle-input-events (diff)
parentswaybar: obey height if given (diff)
downloadsway-fc93cd20dc108544c7cc8fced7aebed58c58a770.tar.gz
sway-fc93cd20dc108544c7cc8fced7aebed58c58a770.tar.zst
sway-fc93cd20dc108544c7cc8fced7aebed58c58a770.zip
Merge pull request #3397 from RedSoxFan/fix-swaybar-height
swaybar: obey height if given
Diffstat (limited to 'swaybar')
-rw-r--r--swaybar/render.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/swaybar/render.c b/swaybar/render.c
index 993c8228..12dd3b07 100644
--- a/swaybar/render.c
+++ b/swaybar/render.c
@@ -45,7 +45,8 @@ static uint32_t render_status_line_error(cairo_t *cairo,
45 45
46 uint32_t ideal_height = text_height + ws_vertical_padding * 2; 46 uint32_t ideal_height = text_height + ws_vertical_padding * 2;
47 uint32_t ideal_surface_height = ideal_height / output->scale; 47 uint32_t ideal_surface_height = ideal_height / output->scale;
48 if (output->height < ideal_surface_height) { 48 if (!output->bar->config->height &&
49 output->height < ideal_surface_height) {
49 return ideal_surface_height; 50 return ideal_surface_height;
50 } 51 }
51 *x -= text_width + margin; 52 *x -= text_width + margin;
@@ -77,7 +78,8 @@ static uint32_t render_status_line_text(cairo_t *cairo,
77 78
78 uint32_t ideal_height = text_height + ws_vertical_padding * 2; 79 uint32_t ideal_height = text_height + ws_vertical_padding * 2;
79 uint32_t ideal_surface_height = ideal_height / output->scale; 80 uint32_t ideal_surface_height = ideal_height / output->scale;
80 if (output->height < ideal_surface_height) { 81 if (!output->bar->config->height &&
82 output->height < ideal_surface_height) {
81 return ideal_surface_height; 83 return ideal_surface_height;
82 } 84 }
83 85
@@ -164,7 +166,8 @@ static uint32_t render_status_block(cairo_t *cairo,
164 double block_width = width; 166 double block_width = width;
165 uint32_t ideal_height = text_height + ws_vertical_padding * 2; 167 uint32_t ideal_height = text_height + ws_vertical_padding * 2;
166 uint32_t ideal_surface_height = ideal_height / output->scale; 168 uint32_t ideal_surface_height = ideal_height / output->scale;
167 if (output->height < ideal_surface_height) { 169 if (!output->bar->config->height &&
170 output->height < ideal_surface_height) {
168 return ideal_surface_height; 171 return ideal_surface_height;
169 } 172 }
170 173
@@ -186,7 +189,8 @@ static uint32_t render_status_block(cairo_t *cairo,
186 output->scale, false, "%s", config->sep_symbol); 189 output->scale, false, "%s", config->sep_symbol);
187 uint32_t _ideal_height = sep_height + ws_vertical_padding * 2; 190 uint32_t _ideal_height = sep_height + ws_vertical_padding * 2;
188 uint32_t _ideal_surface_height = _ideal_height / output->scale; 191 uint32_t _ideal_surface_height = _ideal_height / output->scale;
189 if (output->height < _ideal_surface_height) { 192 if (!output->bar->config->height &&
193 output->height < _ideal_surface_height) {
190 return _ideal_surface_height; 194 return _ideal_surface_height;
191 } 195 }
192 if (sep_width > sep_block_width) { 196 if (sep_width > sep_block_width) {
@@ -333,7 +337,8 @@ static uint32_t render_binding_mode_indicator(cairo_t *cairo,
333 uint32_t ideal_height = text_height + ws_vertical_padding * 2 337 uint32_t ideal_height = text_height + ws_vertical_padding * 2
334 + border_width * 2; 338 + border_width * 2;
335 uint32_t ideal_surface_height = ideal_height / output->scale; 339 uint32_t ideal_surface_height = ideal_height / output->scale;
336 if (output->height < ideal_surface_height) { 340 if (!output->bar->config->height &&
341 output->height < ideal_surface_height) {
337 return ideal_surface_height; 342 return ideal_surface_height;
338 } 343 }
339 uint32_t width = text_width + ws_horizontal_padding * 2 + border_width * 2; 344 uint32_t width = text_width + ws_horizontal_padding * 2 + border_width * 2;
@@ -399,7 +404,8 @@ static uint32_t render_workspace_button(cairo_t *cairo,
399 uint32_t ideal_height = ws_vertical_padding * 2 + text_height 404 uint32_t ideal_height = ws_vertical_padding * 2 + text_height
400 + border_width * 2; 405 + border_width * 2;
401 uint32_t ideal_surface_height = ideal_height / output->scale; 406 uint32_t ideal_surface_height = ideal_height / output->scale;
402 if (output->height < ideal_surface_height) { 407 if (!output->bar->config->height &&
408 output->height < ideal_surface_height) {
403 return ideal_surface_height; 409 return ideal_surface_height;
404 } 410 }
405 411
@@ -526,7 +532,7 @@ void render_frame(struct swaybar_output *output) {
526 cairo_restore(cairo); 532 cairo_restore(cairo);
527 uint32_t height = render_to_cairo(cairo, output); 533 uint32_t height = render_to_cairo(cairo, output);
528 int config_height = output->bar->config->height; 534 int config_height = output->bar->config->height;
529 if (config_height >= 0 && height < (uint32_t)config_height) { 535 if (config_height > 0) {
530 height = config_height; 536 height = config_height;
531 } 537 }
532 if (height != output->height || output->width == 0) { 538 if (height != output->height || output->width == 0) {