diff options
Diffstat (limited to 'swaybar/render.c')
-rw-r--r-- | swaybar/render.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/swaybar/render.c b/swaybar/render.c index 83b4cec7..58325050 100644 --- a/swaybar/render.c +++ b/swaybar/render.c | |||
@@ -8,6 +8,7 @@ | |||
8 | #include "swaybar/config.h" | 8 | #include "swaybar/config.h" |
9 | #include "swaybar/status_line.h" | 9 | #include "swaybar/status_line.h" |
10 | #include "swaybar/render.h" | 10 | #include "swaybar/render.h" |
11 | #include "log.h" | ||
11 | 12 | ||
12 | 13 | ||
13 | /* internal spacing */ | 14 | /* internal spacing */ |
@@ -283,7 +284,8 @@ void render(struct output *output, struct config *config, struct status_line *li | |||
283 | 284 | ||
284 | if (line->protocol == TEXT) { | 285 | if (line->protocol == TEXT) { |
285 | get_text_size(window->cairo, window->font, &width, &height, config->pango_markup, "%s", line->text_line); | 286 | get_text_size(window->cairo, window->font, &width, &height, config->pango_markup, "%s", line->text_line); |
286 | cairo_move_to(cairo, window->width - margin - width, margin); | 287 | cairo_move_to(cairo, (window->width * window->scale) |
288 | - margin - width, margin); | ||
287 | pango_printf(window->cairo, window->font, config->pango_markup, "%s", line->text_line); | 289 | pango_printf(window->cairo, window->font, config->pango_markup, "%s", line->text_line); |
288 | } else if (line->protocol == I3BAR && line->block_line) { | 290 | } else if (line->protocol == I3BAR && line->block_line) { |
289 | double pos = window->width - 0.5; | 291 | double pos = window->width - 0.5; |
@@ -315,12 +317,13 @@ void render(struct output *output, struct config *config, struct status_line *li | |||
315 | } | 317 | } |
316 | 318 | ||
317 | void set_window_height(struct window *window, int height) { | 319 | void set_window_height(struct window *window, int height) { |
318 | int text_width, text_height; | 320 | int text_width, text_height; |
319 | get_text_size(window->cairo, window->font, &text_width, &text_height, false, | 321 | get_text_size(window->cairo, window->font, |
320 | "Test string for measuring purposes"); | 322 | &text_width, &text_height, false, |
321 | if (height > 0) { | 323 | "Test string for measuring purposes"); |
322 | margin = (height - text_height) / 2; | 324 | if (height > 0) { |
323 | ws_vertical_padding = margin - 1.5; | 325 | margin = (height - text_height) / 2; |
324 | } | 326 | ws_vertical_padding = margin - 1.5; |
325 | window->height = text_height + margin * 2; | 327 | } |
328 | window->height = (text_height + margin * 2) / window->scale; | ||
326 | } | 329 | } |