aboutsummaryrefslogtreecommitdiffstats
path: root/swaybar/render.c
diff options
context:
space:
mode:
authorLibravatar Ian Fan <ianfan0@gmail.com>2018-10-12 20:23:01 +0100
committerLibravatar Ian Fan <ianfan0@gmail.com>2018-10-14 13:33:12 +0100
commitfed11d1c7b388e999414dd8cec4b8982ba5ce950 (patch)
tree06ab708d92e6727006aa8912a26a5b3851cc6cd4 /swaybar/render.c
parentswaybar: only send initial workspace request if workspace buttons are enabled (diff)
downloadsway-fed11d1c7b388e999414dd8cec4b8982ba5ce950.tar.gz
sway-fed11d1c7b388e999414dd8cec4b8982ba5ce950.tar.zst
sway-fed11d1c7b388e999414dd8cec4b8982ba5ce950.zip
swaybar: move mode & mode_pango_markup to bar struct
This distinguishes the binding mode from the distinct config mode, as well as removing mode_pango_markup from the config struct where it should not be present.
Diffstat (limited to 'swaybar/render.c')
-rw-r--r--swaybar/render.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/swaybar/render.c b/swaybar/render.c
index 2a06a79b..d226ba32 100644
--- a/swaybar/render.c
+++ b/swaybar/render.c
@@ -296,11 +296,15 @@ static uint32_t render_status_line(cairo_t *cairo,
296 296
297static uint32_t render_binding_mode_indicator(cairo_t *cairo, 297static uint32_t render_binding_mode_indicator(cairo_t *cairo,
298 struct swaybar_output *output, double x) { 298 struct swaybar_output *output, double x) {
299 const char *mode = output->bar->mode;
300 if (!mode) {
301 return 0;
302 }
303
299 struct swaybar_config *config = output->bar->config; 304 struct swaybar_config *config = output->bar->config;
300 const char *mode = config->mode;
301 int text_width, text_height; 305 int text_width, text_height;
302 get_text_size(cairo, config->font, &text_width, &text_height, NULL, 306 get_text_size(cairo, config->font, &text_width, &text_height, NULL,
303 output->scale, config->mode_pango_markup, 307 output->scale, output->bar->mode_pango_markup,
304 "%s", mode); 308 "%s", mode);
305 309
306 int ws_vertical_padding = WS_VERTICAL_PADDING * output->scale; 310 int ws_vertical_padding = WS_VERTICAL_PADDING * output->scale;
@@ -333,8 +337,8 @@ static uint32_t render_binding_mode_indicator(cairo_t *cairo,
333 double text_y = height / 2.0 - text_height / 2.0; 337 double text_y = height / 2.0 - text_height / 2.0;
334 cairo_set_source_u32(cairo, config->colors.binding_mode.text); 338 cairo_set_source_u32(cairo, config->colors.binding_mode.text);
335 cairo_move_to(cairo, x + width / 2 - text_width / 2, (int)floor(text_y)); 339 cairo_move_to(cairo, x + width / 2 - text_width / 2, (int)floor(text_y));
336 pango_printf(cairo, config->font, output->scale, config->mode_pango_markup, 340 pango_printf(cairo, config->font, output->scale,
337 "%s", mode); 341 output->bar->mode_pango_markup, "%s", mode);
338 return output->height; 342 return output->height;
339} 343}
340 344
@@ -465,7 +469,7 @@ static uint32_t render_to_cairo(cairo_t *cairo, struct swaybar_output *output) {
465 max_height = h > max_height ? h : max_height; 469 max_height = h > max_height ? h : max_height;
466 } 470 }
467 } 471 }
468 if (config->binding_mode_indicator && config->mode) { 472 if (config->binding_mode_indicator) {
469 uint32_t h = render_binding_mode_indicator(cairo, output, x); 473 uint32_t h = render_binding_mode_indicator(cairo, output, x);
470 max_height = h > max_height ? h : max_height; 474 max_height = h > max_height ? h : max_height;
471 } 475 }