aboutsummaryrefslogtreecommitdiffstats
path: root/swaybar/render.c
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2019-01-09 20:58:00 -0500
committerLibravatar Brian Ashworth <bosrsf04@gmail.com>2019-01-09 20:58:00 -0500
commit124085eba96362403a757061032659c0a06aa22e (patch)
treef46fd9854bd80e0b29e8ddc67ab77e9dd614ac31 /swaybar/render.c
parentReset container dimensions when moving into workspace from direction (diff)
downloadsway-124085eba96362403a757061032659c0a06aa22e.tar.gz
sway-124085eba96362403a757061032659c0a06aa22e.tar.zst
sway-124085eba96362403a757061032659c0a06aa22e.zip
swaybar: obey height if given
If there is a bar height given, use that as the height rather than as a minimum height. This matches i3-gaps behavior.
Diffstat (limited to 'swaybar/render.c')
-rw-r--r--swaybar/render.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/swaybar/render.c b/swaybar/render.c
index 9fe4ee9c..e149d3a2 100644
--- a/swaybar/render.c
+++ b/swaybar/render.c
@@ -44,7 +44,8 @@ static uint32_t render_status_line_error(cairo_t *cairo,
44 44
45 uint32_t ideal_height = text_height + ws_vertical_padding * 2; 45 uint32_t ideal_height = text_height + ws_vertical_padding * 2;
46 uint32_t ideal_surface_height = ideal_height / output->scale; 46 uint32_t ideal_surface_height = ideal_height / output->scale;
47 if (output->height < ideal_surface_height) { 47 if (!output->bar->config->height &&
48 output->height < ideal_surface_height) {
48 return ideal_surface_height; 49 return ideal_surface_height;
49 } 50 }
50 *x -= text_width + margin; 51 *x -= text_width + margin;
@@ -76,7 +77,8 @@ static uint32_t render_status_line_text(cairo_t *cairo,
76 77
77 uint32_t ideal_height = text_height + ws_vertical_padding * 2; 78 uint32_t ideal_height = text_height + ws_vertical_padding * 2;
78 uint32_t ideal_surface_height = ideal_height / output->scale; 79 uint32_t ideal_surface_height = ideal_height / output->scale;
79 if (output->height < ideal_surface_height) { 80 if (!output->bar->config->height &&
81 output->height < ideal_surface_height) {
80 return ideal_surface_height; 82 return ideal_surface_height;
81 } 83 }
82 84
@@ -151,7 +153,8 @@ static uint32_t render_status_block(cairo_t *cairo,
151 double block_width = width; 153 double block_width = width;
152 uint32_t ideal_height = text_height + ws_vertical_padding * 2; 154 uint32_t ideal_height = text_height + ws_vertical_padding * 2;
153 uint32_t ideal_surface_height = ideal_height / output->scale; 155 uint32_t ideal_surface_height = ideal_height / output->scale;
154 if (output->height < ideal_surface_height) { 156 if (!output->bar->config->height &&
157 output->height < ideal_surface_height) {
155 return ideal_surface_height; 158 return ideal_surface_height;
156 } 159 }
157 160
@@ -173,7 +176,8 @@ static uint32_t render_status_block(cairo_t *cairo,
173 output->scale, false, "%s", config->sep_symbol); 176 output->scale, false, "%s", config->sep_symbol);
174 uint32_t _ideal_height = sep_height + ws_vertical_padding * 2; 177 uint32_t _ideal_height = sep_height + ws_vertical_padding * 2;
175 uint32_t _ideal_surface_height = _ideal_height / output->scale; 178 uint32_t _ideal_surface_height = _ideal_height / output->scale;
176 if (output->height < _ideal_surface_height) { 179 if (!output->bar->config->height &&
180 output->height < _ideal_surface_height) {
177 return _ideal_surface_height; 181 return _ideal_surface_height;
178 } 182 }
179 if (sep_width > sep_block_width) { 183 if (sep_width > sep_block_width) {
@@ -328,7 +332,8 @@ static uint32_t render_binding_mode_indicator(cairo_t *cairo,
328 uint32_t ideal_height = text_height + ws_vertical_padding * 2 332 uint32_t ideal_height = text_height + ws_vertical_padding * 2
329 + border_width * 2; 333 + border_width * 2;
330 uint32_t ideal_surface_height = ideal_height / output->scale; 334 uint32_t ideal_surface_height = ideal_height / output->scale;
331 if (output->height < ideal_surface_height) { 335 if (!output->bar->config->height &&
336 output->height < ideal_surface_height) {
332 return ideal_surface_height; 337 return ideal_surface_height;
333 } 338 }
334 uint32_t width = text_width + ws_horizontal_padding * 2 + border_width * 2; 339 uint32_t width = text_width + ws_horizontal_padding * 2 + border_width * 2;
@@ -394,7 +399,8 @@ static uint32_t render_workspace_button(cairo_t *cairo,
394 uint32_t ideal_height = ws_vertical_padding * 2 + text_height 399 uint32_t ideal_height = ws_vertical_padding * 2 + text_height
395 + border_width * 2; 400 + border_width * 2;
396 uint32_t ideal_surface_height = ideal_height / output->scale; 401 uint32_t ideal_surface_height = ideal_height / output->scale;
397 if (output->height < ideal_surface_height) { 402 if (!output->bar->config->height &&
403 output->height < ideal_surface_height) {
398 return ideal_surface_height; 404 return ideal_surface_height;
399 } 405 }
400 406
@@ -521,7 +527,7 @@ void render_frame(struct swaybar_output *output) {
521 cairo_restore(cairo); 527 cairo_restore(cairo);
522 uint32_t height = render_to_cairo(cairo, output); 528 uint32_t height = render_to_cairo(cairo, output);
523 int config_height = output->bar->config->height; 529 int config_height = output->bar->config->height;
524 if (config_height >= 0 && height < (uint32_t)config_height) { 530 if (config_height > 0) {
525 height = config_height; 531 height = config_height;
526 } 532 }
527 if (height != output->height || output->width == 0) { 533 if (height != output->height || output->width == 0) {