diff options
Diffstat (limited to 'swaybar/render.c')
-rw-r--r-- | swaybar/render.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/swaybar/render.c b/swaybar/render.c index 7e2f97b7..a878805e 100644 --- a/swaybar/render.c +++ b/swaybar/render.c | |||
@@ -62,7 +62,7 @@ static uint32_t render_status_line_error(struct render_context *ctx, double *x) | |||
62 | int margin = 3; | 62 | int margin = 3; |
63 | double ws_vertical_padding = output->bar->config->status_padding; | 63 | double ws_vertical_padding = output->bar->config->status_padding; |
64 | 64 | ||
65 | char *font = output->bar->config->font; | 65 | PangoFontDescription *font = output->bar->config->font_description; |
66 | int text_width, text_height; | 66 | int text_width, text_height; |
67 | get_text_size(cairo, font, &text_width, &text_height, NULL, | 67 | get_text_size(cairo, font, &text_width, &text_height, NULL, |
68 | 1, false, "%s", error); | 68 | 1, false, "%s", error); |
@@ -97,7 +97,7 @@ static uint32_t render_status_line_text(struct render_context *ctx, double *x) { | |||
97 | cairo_set_source_u32(cairo, fontcolor); | 97 | cairo_set_source_u32(cairo, fontcolor); |
98 | 98 | ||
99 | int text_width, text_height; | 99 | int text_width, text_height; |
100 | get_text_size(cairo, config->font, &text_width, &text_height, NULL, | 100 | get_text_size(cairo, config->font_description, &text_width, &text_height, NULL, |
101 | 1, config->pango_markup, "%s", text); | 101 | 1, config->pango_markup, "%s", text); |
102 | 102 | ||
103 | double ws_vertical_padding = config->status_padding; | 103 | double ws_vertical_padding = config->status_padding; |
@@ -115,7 +115,7 @@ static uint32_t render_status_line_text(struct render_context *ctx, double *x) { | |||
115 | double text_y = height / 2.0 - text_height / 2.0; | 115 | double text_y = height / 2.0 - text_height / 2.0; |
116 | cairo_move_to(cairo, *x, (int)floor(text_y)); | 116 | cairo_move_to(cairo, *x, (int)floor(text_y)); |
117 | choose_text_aa_mode(ctx, fontcolor); | 117 | choose_text_aa_mode(ctx, fontcolor); |
118 | render_text(cairo, config->font, 1, config->pango_markup, "%s", text); | 118 | render_text(cairo, config->font_description, 1, config->pango_markup, "%s", text); |
119 | *x -= margin; | 119 | *x -= margin; |
120 | return output->height; | 120 | return output->height; |
121 | } | 121 | } |
@@ -190,7 +190,7 @@ static uint32_t render_status_block(struct render_context *ctx, | |||
190 | struct swaybar_output *output = ctx->output; | 190 | struct swaybar_output *output = ctx->output; |
191 | struct swaybar_config *config = output->bar->config; | 191 | struct swaybar_config *config = output->bar->config; |
192 | int text_width, text_height; | 192 | int text_width, text_height; |
193 | get_text_size(cairo, config->font, &text_width, &text_height, NULL, 1, | 193 | get_text_size(cairo, config->font_description, &text_width, &text_height, NULL, 1, |
194 | block->markup, "%s", text); | 194 | block->markup, "%s", text); |
195 | 195 | ||
196 | int margin = 3; | 196 | int margin = 3; |
@@ -199,7 +199,7 @@ static uint32_t render_status_block(struct render_context *ctx, | |||
199 | int width = text_width; | 199 | int width = text_width; |
200 | if (block->min_width_str) { | 200 | if (block->min_width_str) { |
201 | int w; | 201 | int w; |
202 | get_text_size(cairo, config->font, &w, NULL, NULL, 1, block->markup, | 202 | get_text_size(cairo, config->font_description, &w, NULL, NULL, 1, block->markup, |
203 | "%s", block->min_width_str); | 203 | "%s", block->min_width_str); |
204 | block->min_width = w; | 204 | block->min_width = w; |
205 | } | 205 | } |
@@ -229,7 +229,7 @@ static uint32_t render_status_block(struct render_context *ctx, | |||
229 | int sep_block_width = block->separator_block_width; | 229 | int sep_block_width = block->separator_block_width; |
230 | if (!edge) { | 230 | if (!edge) { |
231 | if (config->sep_symbol) { | 231 | if (config->sep_symbol) { |
232 | get_text_size(cairo, config->font, &sep_width, &sep_height, NULL, | 232 | get_text_size(cairo, config->font_description, &sep_width, &sep_height, NULL, |
233 | 1, false, "%s", config->sep_symbol); | 233 | 1, false, "%s", config->sep_symbol); |
234 | uint32_t _ideal_height = sep_height + ws_vertical_padding * 2; | 234 | uint32_t _ideal_height = sep_height + ws_vertical_padding * 2; |
235 | uint32_t _ideal_surface_height = _ideal_height; | 235 | uint32_t _ideal_surface_height = _ideal_height; |
@@ -307,7 +307,7 @@ static uint32_t render_status_block(struct render_context *ctx, | |||
307 | color = block->urgent ? config->colors.urgent_workspace.text : color; | 307 | color = block->urgent ? config->colors.urgent_workspace.text : color; |
308 | cairo_set_source_u32(cairo, color); | 308 | cairo_set_source_u32(cairo, color); |
309 | choose_text_aa_mode(ctx, color); | 309 | choose_text_aa_mode(ctx, color); |
310 | render_text(cairo, config->font, 1, block->markup, "%s", text); | 310 | render_text(cairo, config->font_description, 1, block->markup, "%s", text); |
311 | x_pos += width; | 311 | x_pos += width; |
312 | 312 | ||
313 | if (block->border_set || block->urgent) { | 313 | if (block->border_set || block->urgent) { |
@@ -331,7 +331,7 @@ static uint32_t render_status_block(struct render_context *ctx, | |||
331 | double sep_y = height / 2.0 - sep_height / 2.0; | 331 | double sep_y = height / 2.0 - sep_height / 2.0; |
332 | cairo_move_to(cairo, offset, (int)floor(sep_y)); | 332 | cairo_move_to(cairo, offset, (int)floor(sep_y)); |
333 | choose_text_aa_mode(ctx, color); | 333 | choose_text_aa_mode(ctx, color); |
334 | render_text(cairo, config->font, 1, false, | 334 | render_text(cairo, config->font_description, 1, false, |
335 | "%s", config->sep_symbol); | 335 | "%s", config->sep_symbol); |
336 | } else { | 336 | } else { |
337 | cairo_set_operator(cairo, CAIRO_OPERATOR_SOURCE); | 337 | cairo_set_operator(cairo, CAIRO_OPERATOR_SOURCE); |
@@ -354,7 +354,7 @@ static void predict_status_block_pos(cairo_t *cairo, | |||
354 | struct swaybar_config *config = output->bar->config; | 354 | struct swaybar_config *config = output->bar->config; |
355 | 355 | ||
356 | int text_width, text_height; | 356 | int text_width, text_height; |
357 | get_text_size(cairo, config->font, &text_width, &text_height, NULL, 1, | 357 | get_text_size(cairo, config->font_description, &text_width, &text_height, NULL, 1, |
358 | block->markup, "%s", block->full_text); | 358 | block->markup, "%s", block->full_text); |
359 | 359 | ||
360 | int margin = 3; | 360 | int margin = 3; |
@@ -364,7 +364,7 @@ static void predict_status_block_pos(cairo_t *cairo, | |||
364 | 364 | ||
365 | if (block->min_width_str) { | 365 | if (block->min_width_str) { |
366 | int w; | 366 | int w; |
367 | get_text_size(cairo, config->font, &w, NULL, NULL, | 367 | get_text_size(cairo, config->font_description, &w, NULL, NULL, |
368 | 1, block->markup, "%s", block->min_width_str); | 368 | 1, block->markup, "%s", block->min_width_str); |
369 | block->min_width = w; | 369 | block->min_width = w; |
370 | } | 370 | } |
@@ -391,7 +391,7 @@ static void predict_status_block_pos(cairo_t *cairo, | |||
391 | int sep_block_width = block->separator_block_width; | 391 | int sep_block_width = block->separator_block_width; |
392 | if (!edge) { | 392 | if (!edge) { |
393 | if (config->sep_symbol) { | 393 | if (config->sep_symbol) { |
394 | get_text_size(cairo, config->font, &sep_width, &sep_height, NULL, | 394 | get_text_size(cairo, config->font_description, &sep_width, &sep_height, NULL, |
395 | 1, false, "%s", config->sep_symbol); | 395 | 1, false, "%s", config->sep_symbol); |
396 | uint32_t _ideal_height = sep_height + ws_vertical_padding * 2; | 396 | uint32_t _ideal_height = sep_height + ws_vertical_padding * 2; |
397 | uint32_t _ideal_surface_height = _ideal_height; | 397 | uint32_t _ideal_surface_height = _ideal_height; |
@@ -426,7 +426,7 @@ static uint32_t predict_workspace_button_length(cairo_t *cairo, | |||
426 | struct swaybar_config *config = output->bar->config; | 426 | struct swaybar_config *config = output->bar->config; |
427 | 427 | ||
428 | int text_width, text_height; | 428 | int text_width, text_height; |
429 | get_text_size(cairo, config->font, &text_width, &text_height, NULL, 1, | 429 | get_text_size(cairo, config->font_description, &text_width, &text_height, NULL, 1, |
430 | config->pango_markup, "%s", ws->label); | 430 | config->pango_markup, "%s", ws->label); |
431 | 431 | ||
432 | int ws_vertical_padding = WS_VERTICAL_PADDING; | 432 | int ws_vertical_padding = WS_VERTICAL_PADDING; |
@@ -474,7 +474,7 @@ static uint32_t predict_binding_mode_indicator_length(cairo_t *cairo, | |||
474 | } | 474 | } |
475 | 475 | ||
476 | int text_width, text_height; | 476 | int text_width, text_height; |
477 | get_text_size(cairo, config->font, &text_width, &text_height, NULL, | 477 | get_text_size(cairo, config->font_description, &text_width, &text_height, NULL, |
478 | 1, output->bar->mode_pango_markup, | 478 | 1, output->bar->mode_pango_markup, |
479 | "%s", mode); | 479 | "%s", mode); |
480 | 480 | ||
@@ -551,7 +551,7 @@ static uint32_t render_binding_mode_indicator(struct render_context *ctx, | |||
551 | cairo_t *cairo = ctx->cairo; | 551 | cairo_t *cairo = ctx->cairo; |
552 | struct swaybar_config *config = output->bar->config; | 552 | struct swaybar_config *config = output->bar->config; |
553 | int text_width, text_height; | 553 | int text_width, text_height; |
554 | get_text_size(cairo, config->font, &text_width, &text_height, NULL, | 554 | get_text_size(cairo, config->font_description, &text_width, &text_height, NULL, |
555 | 1, output->bar->mode_pango_markup, | 555 | 1, output->bar->mode_pango_markup, |
556 | "%s", mode); | 556 | "%s", mode); |
557 | 557 | ||
@@ -592,7 +592,7 @@ static uint32_t render_binding_mode_indicator(struct render_context *ctx, | |||
592 | cairo_set_source_u32(cairo, config->colors.binding_mode.text); | 592 | cairo_set_source_u32(cairo, config->colors.binding_mode.text); |
593 | cairo_move_to(cairo, x + width / 2 - text_width / 2, (int)floor(text_y)); | 593 | cairo_move_to(cairo, x + width / 2 - text_width / 2, (int)floor(text_y)); |
594 | choose_text_aa_mode(ctx, config->colors.binding_mode.text); | 594 | choose_text_aa_mode(ctx, config->colors.binding_mode.text); |
595 | render_text(cairo, config->font, 1, output->bar->mode_pango_markup, | 595 | render_text(cairo, config->font_description, 1, output->bar->mode_pango_markup, |
596 | "%s", mode); | 596 | "%s", mode); |
597 | return output->height; | 597 | return output->height; |
598 | } | 598 | } |
@@ -626,7 +626,7 @@ static uint32_t render_workspace_button(struct render_context *ctx, | |||
626 | 626 | ||
627 | cairo_t *cairo = ctx->cairo; | 627 | cairo_t *cairo = ctx->cairo; |
628 | int text_width, text_height; | 628 | int text_width, text_height; |
629 | get_text_size(cairo, config->font, &text_width, &text_height, NULL, | 629 | get_text_size(cairo, config->font_description, &text_width, &text_height, NULL, |
630 | 1, config->pango_markup, "%s", ws->label); | 630 | 1, config->pango_markup, "%s", ws->label); |
631 | 631 | ||
632 | int ws_vertical_padding = WS_VERTICAL_PADDING; | 632 | int ws_vertical_padding = WS_VERTICAL_PADDING; |
@@ -666,7 +666,7 @@ static uint32_t render_workspace_button(struct render_context *ctx, | |||
666 | cairo_set_source_u32(cairo, box_colors.text); | 666 | cairo_set_source_u32(cairo, box_colors.text); |
667 | cairo_move_to(cairo, *x + width / 2 - text_width / 2, (int)floor(text_y)); | 667 | cairo_move_to(cairo, *x + width / 2 - text_width / 2, (int)floor(text_y)); |
668 | choose_text_aa_mode(ctx, box_colors.text); | 668 | choose_text_aa_mode(ctx, box_colors.text); |
669 | render_text(cairo, config->font, 1, config->pango_markup, | 669 | render_text(cairo, config->font_description, 1, config->pango_markup, |
670 | "%s", ws->label); | 670 | "%s", ws->label); |
671 | 671 | ||
672 | struct swaybar_hotspot *hotspot = calloc(1, sizeof(struct swaybar_hotspot)); | 672 | struct swaybar_hotspot *hotspot = calloc(1, sizeof(struct swaybar_hotspot)); |
@@ -699,7 +699,7 @@ static uint32_t render_to_cairo(struct render_context *ctx) { | |||
699 | cairo_paint(cairo); | 699 | cairo_paint(cairo); |
700 | 700 | ||
701 | int th; | 701 | int th; |
702 | get_text_size(cairo, config->font, NULL, &th, NULL, 1, false, ""); | 702 | get_text_size(cairo, config->font_description, NULL, &th, NULL, 1, false, ""); |
703 | uint32_t max_height = (th + WS_VERTICAL_PADDING * 4); | 703 | uint32_t max_height = (th + WS_VERTICAL_PADDING * 4); |
704 | /* | 704 | /* |
705 | * Each render_* function takes the actual height of the bar, and returns | 705 | * Each render_* function takes the actual height of the bar, and returns |