diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-09-08 09:19:47 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-08 09:19:47 -0400 |
commit | 3600b3db577298bc553c394a4b09e71163f76561 (patch) | |
tree | a1defcadae4b1d07388fd9e6bfe2a09051aec777 | |
parent | Merge pull request #2603 from emersion/fix-dnd (diff) | |
parent | Align titles to baseline (diff) | |
download | sway-3600b3db577298bc553c394a4b09e71163f76561.tar.gz sway-3600b3db577298bc553c394a4b09e71163f76561.tar.zst sway-3600b3db577298bc553c394a4b09e71163f76561.zip |
Merge pull request #2602 from RyanDwyer/fix-title-textures
Fix gaps in title textures and vertically center them
-rw-r--r-- | common/pango.c | 5 | ||||
-rw-r--r-- | include/pango.h | 2 | ||||
-rw-r--r-- | include/sway/config.h | 1 | ||||
-rw-r--r-- | include/sway/tree/container.h | 1 | ||||
-rw-r--r-- | sway/config.c | 21 | ||||
-rw-r--r-- | sway/debug-tree.c | 2 | ||||
-rw-r--r-- | sway/desktop/render.c | 90 | ||||
-rw-r--r-- | sway/tree/container.c | 10 | ||||
-rw-r--r-- | sway/tree/view.c | 3 | ||||
-rw-r--r-- | swaybar/render.c | 14 | ||||
-rw-r--r-- | swaynag/render.c | 10 |
11 files changed, 111 insertions, 48 deletions
diff --git a/common/pango.c b/common/pango.c index 92703f80..ea71ac4a 100644 --- a/common/pango.c +++ b/common/pango.c | |||
@@ -103,7 +103,7 @@ PangoLayout *get_pango_layout(cairo_t *cairo, const char *font, | |||
103 | } | 103 | } |
104 | 104 | ||
105 | void get_text_size(cairo_t *cairo, const char *font, int *width, int *height, | 105 | void get_text_size(cairo_t *cairo, const char *font, int *width, int *height, |
106 | double scale, bool markup, const char *fmt, ...) { | 106 | int *baseline, double scale, bool markup, const char *fmt, ...) { |
107 | static char buf[2048]; | 107 | static char buf[2048]; |
108 | 108 | ||
109 | va_list args; | 109 | va_list args; |
@@ -116,6 +116,9 @@ void get_text_size(cairo_t *cairo, const char *font, int *width, int *height, | |||
116 | PangoLayout *layout = get_pango_layout(cairo, font, buf, scale, markup); | 116 | PangoLayout *layout = get_pango_layout(cairo, font, buf, scale, markup); |
117 | pango_cairo_update_layout(cairo, layout); | 117 | pango_cairo_update_layout(cairo, layout); |
118 | pango_layout_get_pixel_size(layout, width, height); | 118 | pango_layout_get_pixel_size(layout, width, height); |
119 | if (baseline) { | ||
120 | *baseline = pango_layout_get_baseline(layout) / PANGO_SCALE; | ||
121 | } | ||
119 | g_object_unref(layout); | 122 | g_object_unref(layout); |
120 | } | 123 | } |
121 | 124 | ||
diff --git a/include/pango.h b/include/pango.h index 4492f01e..09a535a5 100644 --- a/include/pango.h +++ b/include/pango.h | |||
@@ -20,7 +20,7 @@ int escape_markup_text(const char *src, char *dest, int dest_length); | |||
20 | PangoLayout *get_pango_layout(cairo_t *cairo, const char *font, | 20 | PangoLayout *get_pango_layout(cairo_t *cairo, const char *font, |
21 | const char *text, double scale, bool markup); | 21 | const char *text, double scale, bool markup); |
22 | void get_text_size(cairo_t *cairo, const char *font, int *width, int *height, | 22 | void get_text_size(cairo_t *cairo, const char *font, int *width, int *height, |
23 | double scale, bool markup, const char *fmt, ...); | 23 | int *baseline, double scale, bool markup, const char *fmt, ...); |
24 | void pango_printf(cairo_t *cairo, const char *font, | 24 | void pango_printf(cairo_t *cairo, const char *font, |
25 | double scale, bool markup, const char *fmt, ...); | 25 | double scale, bool markup, const char *fmt, ...); |
26 | 26 | ||
diff --git a/include/sway/config.h b/include/sway/config.h index 2fef0081..b52bb681 100644 --- a/include/sway/config.h +++ b/include/sway/config.h | |||
@@ -349,6 +349,7 @@ struct sway_config { | |||
349 | enum sway_container_layout default_layout; | 349 | enum sway_container_layout default_layout; |
350 | char *font; | 350 | char *font; |
351 | size_t font_height; | 351 | size_t font_height; |
352 | size_t font_baseline; | ||
352 | bool pango_markup; | 353 | bool pango_markup; |
353 | size_t urgent_timeout; | 354 | size_t urgent_timeout; |
354 | enum sway_fowa focus_on_window_activation; | 355 | enum sway_fowa focus_on_window_activation; |
diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h index 6efecf7c..2735daa3 100644 --- a/include/sway/tree/container.h +++ b/include/sway/tree/container.h | |||
@@ -117,6 +117,7 @@ struct sway_container { | |||
117 | struct wlr_texture *title_unfocused; | 117 | struct wlr_texture *title_unfocused; |
118 | struct wlr_texture *title_urgent; | 118 | struct wlr_texture *title_urgent; |
119 | size_t title_height; | 119 | size_t title_height; |
120 | size_t title_baseline; | ||
120 | 121 | ||
121 | struct { | 122 | struct { |
122 | struct wl_signal destroy; | 123 | struct wl_signal destroy; |
diff --git a/sway/config.c b/sway/config.c index 89701640..6ff4da03 100644 --- a/sway/config.c +++ b/sway/config.c | |||
@@ -807,22 +807,31 @@ int workspace_output_cmp_workspace(const void *a, const void *b) { | |||
807 | return lenient_strcmp(wsa->workspace, wsb->workspace); | 807 | return lenient_strcmp(wsa->workspace, wsb->workspace); |
808 | } | 808 | } |
809 | 809 | ||
810 | static void find_font_height_iterator(struct sway_container *container, | 810 | static void find_font_height_iterator(struct sway_container *con, void *data) { |
811 | void *data) { | 811 | size_t amount_below_baseline = con->title_height - con->title_baseline; |
812 | size_t extended_height = config->font_baseline + amount_below_baseline; | ||
813 | if (extended_height > config->font_height) { | ||
814 | config->font_height = extended_height; | ||
815 | } | ||
816 | } | ||
817 | |||
818 | static void find_baseline_iterator(struct sway_container *con, void *data) { | ||
812 | bool *recalculate = data; | 819 | bool *recalculate = data; |
813 | if (*recalculate) { | 820 | if (*recalculate) { |
814 | container_calculate_title_height(container); | 821 | container_calculate_title_height(con); |
815 | } | 822 | } |
816 | if (container->title_height > config->font_height) { | 823 | if (con->title_baseline > config->font_baseline) { |
817 | config->font_height = container->title_height; | 824 | config->font_baseline = con->title_baseline; |
818 | } | 825 | } |
819 | } | 826 | } |
820 | 827 | ||
821 | void config_update_font_height(bool recalculate) { | 828 | void config_update_font_height(bool recalculate) { |
822 | size_t prev_max_height = config->font_height; | 829 | size_t prev_max_height = config->font_height; |
823 | config->font_height = 0; | 830 | config->font_height = 0; |
831 | config->font_baseline = 0; | ||
824 | 832 | ||
825 | root_for_each_container(find_font_height_iterator, &recalculate); | 833 | root_for_each_container(find_baseline_iterator, &recalculate); |
834 | root_for_each_container(find_font_height_iterator, NULL); | ||
826 | 835 | ||
827 | if (config->font_height != prev_max_height) { | 836 | if (config->font_height != prev_max_height) { |
828 | arrange_root(); | 837 | arrange_root(); |
diff --git a/sway/debug-tree.c b/sway/debug-tree.c index 973c6d88..9644f4e5 100644 --- a/sway/debug-tree.c +++ b/sway/debug-tree.c | |||
@@ -84,7 +84,7 @@ static int draw_node(cairo_t *cairo, struct sway_node *node, | |||
84 | struct sway_node *focus, int x, int y) { | 84 | struct sway_node *focus, int x, int y) { |
85 | int text_width, text_height; | 85 | int text_width, text_height; |
86 | char *buffer = get_string(node); | 86 | char *buffer = get_string(node); |
87 | get_text_size(cairo, "monospace", &text_width, &text_height, | 87 | get_text_size(cairo, "monospace", &text_width, &text_height, NULL, |
88 | 1, false, buffer); | 88 | 1, false, buffer); |
89 | cairo_save(cairo); | 89 | cairo_save(cairo); |
90 | cairo_rectangle(cairo, x + 2, y, text_width - 2, text_height); | 90 | cairo_rectangle(cairo, x + 2, y, text_width - 2, text_height); |
diff --git a/sway/desktop/render.c b/sway/desktop/render.c index d72d72bf..8a6f63aa 100644 --- a/sway/desktop/render.c +++ b/sway/desktop/render.c | |||
@@ -146,6 +146,8 @@ static void render_drag_icons(struct sway_output *output, | |||
146 | render_surface_iterator, &data); | 146 | render_surface_iterator, &data); |
147 | } | 147 | } |
148 | 148 | ||
149 | // _box.x and .y are expected to be layout-local | ||
150 | // _box.width and .height are expected to be output-buffer-local | ||
149 | static void render_rect(struct wlr_output *wlr_output, | 151 | static void render_rect(struct wlr_output *wlr_output, |
150 | pixman_region32_t *output_damage, const struct wlr_box *_box, | 152 | pixman_region32_t *output_damage, const struct wlr_box *_box, |
151 | float color[static 4]) { | 153 | float color[static 4]) { |
@@ -404,9 +406,20 @@ static void render_titlebar(struct sway_output *output, | |||
404 | struct wlr_box texture_box; | 406 | struct wlr_box texture_box; |
405 | wlr_texture_get_size(marks_texture, | 407 | wlr_texture_get_size(marks_texture, |
406 | &texture_box.width, &texture_box.height); | 408 | &texture_box.width, &texture_box.height); |
409 | marks_ob_width = texture_box.width; | ||
410 | |||
411 | // The marks texture might be shorter than the config->font_height, in | ||
412 | // which case we need to pad it as evenly as possible above and below. | ||
413 | int ob_padding_total = config->font_height * output_scale - | ||
414 | texture_box.height; | ||
415 | int ob_padding_above = floor(ob_padding_total / 2); | ||
416 | int ob_padding_below = ceil(ob_padding_total / 2); | ||
417 | |||
418 | // Render texture | ||
407 | texture_box.x = (x - output_x + width - TITLEBAR_H_PADDING) | 419 | texture_box.x = (x - output_x + width - TITLEBAR_H_PADDING) |
408 | * output_scale - texture_box.width; | 420 | * output_scale - texture_box.width; |
409 | texture_box.y = (y - output_y + TITLEBAR_V_PADDING) * output_scale; | 421 | texture_box.y = (y - output_y + TITLEBAR_V_PADDING) * output_scale + |
422 | ob_padding_above; | ||
410 | 423 | ||
411 | float matrix[9]; | 424 | float matrix[9]; |
412 | wlr_matrix_project_box(matrix, &texture_box, | 425 | wlr_matrix_project_box(matrix, &texture_box, |
@@ -418,17 +431,29 @@ static void render_titlebar(struct sway_output *output, | |||
418 | } | 431 | } |
419 | render_texture(output->wlr_output, output_damage, marks_texture, | 432 | render_texture(output->wlr_output, output_damage, marks_texture, |
420 | &texture_box, matrix, con->alpha); | 433 | &texture_box, matrix, con->alpha); |
421 | marks_ob_width = texture_box.width; | ||
422 | 434 | ||
423 | // Gap between the marks and bottom padding, for when the marks texture | 435 | // Padding above |
424 | // height is smaller than the config's font height | 436 | if (ob_padding_above > 0) { |
425 | memcpy(&color, colors->background, sizeof(float) * 4); | 437 | memcpy(&color, colors->background, sizeof(float) * 4); |
426 | premultiply_alpha(color, con->alpha); | 438 | premultiply_alpha(color, con->alpha); |
427 | box.x = texture_box.x; | 439 | box.x = (x + width - TITLEBAR_H_PADDING) * output_scale - |
428 | box.y = texture_box.y + texture_box.height; | 440 | texture_box.width; |
429 | box.width = texture_box.width; | 441 | box.y = (y + TITLEBAR_V_PADDING) * output_scale; |
430 | box.height = config->font_height * output_scale - texture_box.height; | 442 | box.width = texture_box.width; |
431 | if (box.height > 0) { | 443 | box.height = ob_padding_above; |
444 | render_rect(output->wlr_output, output_damage, &box, color); | ||
445 | } | ||
446 | |||
447 | // Padding below | ||
448 | if (ob_padding_below > 0) { | ||
449 | memcpy(&color, colors->background, sizeof(float) * 4); | ||
450 | premultiply_alpha(color, con->alpha); | ||
451 | box.x = (x + width - TITLEBAR_H_PADDING) * output_scale - | ||
452 | texture_box.width; | ||
453 | box.y = (y + TITLEBAR_V_PADDING) * output_scale + | ||
454 | ob_padding_above + texture_box.height; | ||
455 | box.width = texture_box.width; | ||
456 | box.height = ob_padding_below; | ||
432 | render_rect(output->wlr_output, output_damage, &box, color); | 457 | render_rect(output->wlr_output, output_damage, &box, color); |
433 | } | 458 | } |
434 | } | 459 | } |
@@ -439,8 +464,19 @@ static void render_titlebar(struct sway_output *output, | |||
439 | struct wlr_box texture_box; | 464 | struct wlr_box texture_box; |
440 | wlr_texture_get_size(title_texture, | 465 | wlr_texture_get_size(title_texture, |
441 | &texture_box.width, &texture_box.height); | 466 | &texture_box.width, &texture_box.height); |
467 | title_ob_width = texture_box.width; | ||
468 | |||
469 | // The title texture might be shorter than the config->font_height, | ||
470 | // in which case we need to pad it above and below. | ||
471 | int ob_padding_above = (config->font_baseline - con->title_baseline) | ||
472 | * output_scale; | ||
473 | int ob_padding_below = (config->font_height - con->title_height) | ||
474 | * output_scale - ob_padding_above; | ||
475 | |||
476 | // Render texture | ||
442 | texture_box.x = (x - output_x + TITLEBAR_H_PADDING) * output_scale; | 477 | texture_box.x = (x - output_x + TITLEBAR_H_PADDING) * output_scale; |
443 | texture_box.y = (y - output_y + TITLEBAR_V_PADDING) * output_scale; | 478 | texture_box.y = (y - output_y + TITLEBAR_V_PADDING) * output_scale + |
479 | ob_padding_above; | ||
444 | 480 | ||
445 | float matrix[9]; | 481 | float matrix[9]; |
446 | wlr_matrix_project_box(matrix, &texture_box, | 482 | wlr_matrix_project_box(matrix, &texture_box, |
@@ -452,17 +488,27 @@ static void render_titlebar(struct sway_output *output, | |||
452 | } | 488 | } |
453 | render_texture(output->wlr_output, output_damage, title_texture, | 489 | render_texture(output->wlr_output, output_damage, title_texture, |
454 | &texture_box, matrix, con->alpha); | 490 | &texture_box, matrix, con->alpha); |
455 | title_ob_width = texture_box.width; | ||
456 | 491 | ||
457 | // Gap between the title and bottom padding, for when the title texture | 492 | // Padding above |
458 | // height is smaller than the config's font height | 493 | if (ob_padding_above > 0) { |
459 | memcpy(&color, colors->background, sizeof(float) * 4); | 494 | memcpy(&color, colors->background, sizeof(float) * 4); |
460 | premultiply_alpha(color, con->alpha); | 495 | premultiply_alpha(color, con->alpha); |
461 | box.x = texture_box.x; | 496 | box.x = (x + TITLEBAR_H_PADDING) * output_scale; |
462 | box.y = texture_box.y + texture_box.height; | 497 | box.y = (y + TITLEBAR_V_PADDING) * output_scale; |
463 | box.width = texture_box.width; | 498 | box.width = texture_box.width; |
464 | box.height = config->font_height * output_scale - texture_box.height; | 499 | box.height = ob_padding_above; |
465 | if (box.height > 0) { | 500 | render_rect(output->wlr_output, output_damage, &box, color); |
501 | } | ||
502 | |||
503 | // Padding below | ||
504 | if (ob_padding_below > 0) { | ||
505 | memcpy(&color, colors->background, sizeof(float) * 4); | ||
506 | premultiply_alpha(color, con->alpha); | ||
507 | box.x = (x + TITLEBAR_H_PADDING) * output_scale; | ||
508 | box.y = (y + TITLEBAR_V_PADDING) * output_scale + | ||
509 | ob_padding_above + texture_box.height; | ||
510 | box.width = texture_box.width; | ||
511 | box.height = ob_padding_below; | ||
466 | render_rect(output->wlr_output, output_damage, &box, color); | 512 | render_rect(output->wlr_output, output_damage, &box, color); |
467 | } | 513 | } |
468 | } | 514 | } |
diff --git a/sway/tree/container.c b/sway/tree/container.c index cbbb1f56..ccd79f0e 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c | |||
@@ -455,8 +455,8 @@ static void update_title_texture(struct sway_container *con, | |||
455 | int height = con->title_height * scale; | 455 | int height = con->title_height * scale; |
456 | 456 | ||
457 | cairo_t *c = cairo_create(NULL); | 457 | cairo_t *c = cairo_create(NULL); |
458 | get_text_size(c, config->font, &width, NULL, scale, config->pango_markup, | 458 | get_text_size(c, config->font, &width, NULL, NULL, scale, |
459 | "%s", con->formatted_title); | 459 | config->pango_markup, "%s", con->formatted_title); |
460 | cairo_destroy(c); | 460 | cairo_destroy(c); |
461 | 461 | ||
462 | cairo_surface_t *surface = cairo_image_surface_create( | 462 | cairo_surface_t *surface = cairo_image_surface_create( |
@@ -505,10 +505,12 @@ void container_calculate_title_height(struct sway_container *container) { | |||
505 | } | 505 | } |
506 | cairo_t *cairo = cairo_create(NULL); | 506 | cairo_t *cairo = cairo_create(NULL); |
507 | int height; | 507 | int height; |
508 | get_text_size(cairo, config->font, NULL, &height, 1, config->pango_markup, | 508 | int baseline; |
509 | "%s", container->formatted_title); | 509 | get_text_size(cairo, config->font, NULL, &height, &baseline, 1, |
510 | config->pango_markup, "%s", container->formatted_title); | ||
510 | cairo_destroy(cairo); | 511 | cairo_destroy(cairo); |
511 | container->title_height = height; | 512 | container->title_height = height; |
513 | container->title_baseline = baseline; | ||
512 | } | 514 | } |
513 | 515 | ||
514 | /** | 516 | /** |
diff --git a/sway/tree/view.c b/sway/tree/view.c index 312c62d1..53215b40 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c | |||
@@ -935,7 +935,8 @@ static void update_marks_texture(struct sway_view *view, | |||
935 | int height = view->container->title_height * scale; | 935 | int height = view->container->title_height * scale; |
936 | 936 | ||
937 | cairo_t *c = cairo_create(NULL); | 937 | cairo_t *c = cairo_create(NULL); |
938 | get_text_size(c, config->font, &width, NULL, scale, false, "%s", buffer); | 938 | get_text_size(c, config->font, &width, NULL, NULL, scale, false, |
939 | "%s", buffer); | ||
939 | cairo_destroy(c); | 940 | cairo_destroy(c); |
940 | 941 | ||
941 | cairo_surface_t *surface = cairo_image_surface_create( | 942 | cairo_surface_t *surface = cairo_image_surface_create( |
diff --git a/swaybar/render.c b/swaybar/render.c index 702e863c..7303e70f 100644 --- a/swaybar/render.c +++ b/swaybar/render.c | |||
@@ -33,8 +33,8 @@ static uint32_t render_status_line_error(cairo_t *cairo, | |||
33 | int ws_vertical_padding = WS_VERTICAL_PADDING * output->scale; | 33 | int ws_vertical_padding = WS_VERTICAL_PADDING * output->scale; |
34 | 34 | ||
35 | int text_width, text_height; | 35 | int text_width, text_height; |
36 | get_text_size(cairo, config->font, | 36 | get_text_size(cairo, config->font, &text_width, &text_height, NULL, |
37 | &text_width, &text_height, output->scale, false, "%s", error); | 37 | output->scale, false, "%s", error); |
38 | 38 | ||
39 | uint32_t ideal_height = text_height + ws_vertical_padding * 2; | 39 | uint32_t ideal_height = text_height + ws_vertical_padding * 2; |
40 | uint32_t ideal_surface_height = ideal_height / output->scale; | 40 | uint32_t ideal_surface_height = ideal_height / output->scale; |
@@ -63,7 +63,7 @@ static uint32_t render_status_line_text(cairo_t *cairo, | |||
63 | config->colors.focused_statusline : config->colors.statusline); | 63 | config->colors.focused_statusline : config->colors.statusline); |
64 | 64 | ||
65 | int text_width, text_height; | 65 | int text_width, text_height; |
66 | get_text_size(cairo, config->font, &text_width, &text_height, | 66 | get_text_size(cairo, config->font, &text_width, &text_height, NULL, |
67 | output->scale, config->pango_markup, "%s", text); | 67 | output->scale, config->pango_markup, "%s", text); |
68 | 68 | ||
69 | int ws_vertical_padding = WS_VERTICAL_PADDING * output->scale; | 69 | int ws_vertical_padding = WS_VERTICAL_PADDING * output->scale; |
@@ -126,7 +126,7 @@ static uint32_t render_status_block(cairo_t *cairo, | |||
126 | uint32_t height = surface_height * output->scale; | 126 | uint32_t height = surface_height * output->scale; |
127 | 127 | ||
128 | int text_width, text_height; | 128 | int text_width, text_height; |
129 | get_text_size(cairo, config->font, &text_width, &text_height, | 129 | get_text_size(cairo, config->font, &text_width, &text_height, NULL, |
130 | output->scale, block->markup, "%s", block->full_text); | 130 | output->scale, block->markup, "%s", block->full_text); |
131 | 131 | ||
132 | int margin = 3 * output->scale; | 132 | int margin = 3 * output->scale; |
@@ -157,7 +157,7 @@ static uint32_t render_status_block(cairo_t *cairo, | |||
157 | int sep_width, sep_height; | 157 | int sep_width, sep_height; |
158 | if (!edge) { | 158 | if (!edge) { |
159 | if (config->sep_symbol) { | 159 | if (config->sep_symbol) { |
160 | get_text_size(cairo, config->font, &sep_width, &sep_height, | 160 | get_text_size(cairo, config->font, &sep_width, &sep_height, NULL, |
161 | output->scale, false, "%s", config->sep_symbol); | 161 | output->scale, false, "%s", config->sep_symbol); |
162 | uint32_t _ideal_height = sep_height + ws_vertical_padding * 2; | 162 | uint32_t _ideal_height = sep_height + ws_vertical_padding * 2; |
163 | uint32_t _ideal_surface_height = _ideal_height / output->scale; | 163 | uint32_t _ideal_surface_height = _ideal_height / output->scale; |
@@ -297,7 +297,7 @@ static uint32_t render_binding_mode_indicator(cairo_t *cairo, | |||
297 | uint32_t height = surface_height * output->scale; | 297 | uint32_t height = surface_height * output->scale; |
298 | 298 | ||
299 | int text_width, text_height; | 299 | int text_width, text_height; |
300 | get_text_size(cairo, config->font, &text_width, &text_height, | 300 | get_text_size(cairo, config->font, &text_width, &text_height, NULL, |
301 | output->scale, config->mode_pango_markup, | 301 | output->scale, config->mode_pango_markup, |
302 | "%s", mode); | 302 | "%s", mode); |
303 | 303 | ||
@@ -379,7 +379,7 @@ static uint32_t render_workspace_button(cairo_t *cairo, | |||
379 | uint32_t height = surface_height * output->scale; | 379 | uint32_t height = surface_height * output->scale; |
380 | 380 | ||
381 | int text_width, text_height; | 381 | int text_width, text_height; |
382 | get_text_size(cairo, config->font, &text_width, &text_height, | 382 | get_text_size(cairo, config->font, &text_width, &text_height, NULL, |
383 | output->scale, config->pango_markup, "%s", name); | 383 | output->scale, config->pango_markup, "%s", name); |
384 | 384 | ||
385 | int ws_vertical_padding = WS_VERTICAL_PADDING * output->scale; | 385 | int ws_vertical_padding = WS_VERTICAL_PADDING * output->scale; |
diff --git a/swaynag/render.c b/swaynag/render.c index 766409e4..7db9fe60 100644 --- a/swaynag/render.c +++ b/swaynag/render.c | |||
@@ -12,7 +12,7 @@ static uint32_t render_message(cairo_t *cairo, struct swaynag *swaynag) { | |||
12 | height -= swaynag->type->bar_border_thickness * swaynag->scale; | 12 | height -= swaynag->type->bar_border_thickness * swaynag->scale; |
13 | 13 | ||
14 | int text_width, text_height; | 14 | int text_width, text_height; |
15 | get_text_size(cairo, swaynag->type->font, &text_width, &text_height, | 15 | get_text_size(cairo, swaynag->type->font, &text_width, &text_height, NULL, |
16 | swaynag->scale, true, "%s", swaynag->message); | 16 | swaynag->scale, true, "%s", swaynag->message); |
17 | 17 | ||
18 | int padding = swaynag->type->message_padding * swaynag->scale; | 18 | int padding = swaynag->type->message_padding * swaynag->scale; |
@@ -34,7 +34,7 @@ static uint32_t render_message(cairo_t *cairo, struct swaynag *swaynag) { | |||
34 | static void render_details_scroll_button(cairo_t *cairo, | 34 | static void render_details_scroll_button(cairo_t *cairo, |
35 | struct swaynag *swaynag, struct swaynag_button *button) { | 35 | struct swaynag *swaynag, struct swaynag_button *button) { |
36 | int text_width, text_height; | 36 | int text_width, text_height; |
37 | get_text_size(cairo, swaynag->type->font, &text_width, &text_height, | 37 | get_text_size(cairo, swaynag->type->font, &text_width, &text_height, NULL, |
38 | swaynag->scale, true, "%s", button->text); | 38 | swaynag->scale, true, "%s", button->text); |
39 | 39 | ||
40 | int border = swaynag->type->button_border_thickness * swaynag->scale; | 40 | int border = swaynag->type->button_border_thickness * swaynag->scale; |
@@ -60,10 +60,10 @@ static void render_details_scroll_button(cairo_t *cairo, | |||
60 | static int get_detailed_scroll_button_width(cairo_t *cairo, | 60 | static int get_detailed_scroll_button_width(cairo_t *cairo, |
61 | struct swaynag *swaynag) { | 61 | struct swaynag *swaynag) { |
62 | int up_width, down_width, temp_height; | 62 | int up_width, down_width, temp_height; |
63 | get_text_size(cairo, swaynag->type->font, &up_width, &temp_height, | 63 | get_text_size(cairo, swaynag->type->font, &up_width, &temp_height, NULL, |
64 | swaynag->scale, true, | 64 | swaynag->scale, true, |
65 | "%s", swaynag->details.button_up.text); | 65 | "%s", swaynag->details.button_up.text); |
66 | get_text_size(cairo, swaynag->type->font, &down_width, &temp_height, | 66 | get_text_size(cairo, swaynag->type->font, &down_width, &temp_height, NULL, |
67 | swaynag->scale, true, | 67 | swaynag->scale, true, |
68 | "%s", swaynag->details.button_down.text); | 68 | "%s", swaynag->details.button_down.text); |
69 | 69 | ||
@@ -179,7 +179,7 @@ static uint32_t render_button(cairo_t *cairo, struct swaynag *swaynag, | |||
179 | struct swaynag_button *button = swaynag->buttons->items[button_index]; | 179 | struct swaynag_button *button = swaynag->buttons->items[button_index]; |
180 | 180 | ||
181 | int text_width, text_height; | 181 | int text_width, text_height; |
182 | get_text_size(cairo, swaynag->type->font, &text_width, &text_height, | 182 | get_text_size(cairo, swaynag->type->font, &text_width, &text_height, NULL, |
183 | swaynag->scale, true, "%s", button->text); | 183 | swaynag->scale, true, "%s", button->text); |
184 | 184 | ||
185 | int border = swaynag->type->button_border_thickness * swaynag->scale; | 185 | int border = swaynag->type->button_border_thickness * swaynag->scale; |