diff options
Diffstat (limited to 'swaybar')
-rw-r--r-- | swaybar/bar.c | 9 | ||||
-rw-r--r-- | swaybar/render.c | 21 |
2 files changed, 18 insertions, 12 deletions
diff --git a/swaybar/bar.c b/swaybar/bar.c index f3767409..7ec3e0ea 100644 --- a/swaybar/bar.c +++ b/swaybar/bar.c @@ -152,12 +152,15 @@ void bar_setup(struct bar *bar, const char *socket_path, const char *bar_id) { struct output_state *output = bar_output->registry->outputs->items[bar_output->idx]; - bar_output->window = window_setup(bar_output->registry, output->width * output->scale, 30 * output->scale, false); + bar_output->window = window_setup(bar_output->registry, + output->width / output->scale, 30, output->scale, false); if (!bar_output->window) { sway_abort("Failed to create window."); } - desktop_shell_set_panel(bar_output->registry->desktop_shell, output->output, bar_output->window->surface); - desktop_shell_set_panel_position(bar_output->registry->desktop_shell, bar->config->position); + desktop_shell_set_panel(bar_output->registry->desktop_shell, + output->output, bar_output->window->surface); + desktop_shell_set_panel_position(bar_output->registry->desktop_shell, + bar->config->position); window_make_shell(bar_output->window); 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 @@ #include "swaybar/config.h" #include "swaybar/status_line.h" #include "swaybar/render.h" +#include "log.h" /* internal spacing */ @@ -283,7 +284,8 @@ void render(struct output *output, struct config *config, struct status_line *li if (line->protocol == TEXT) { get_text_size(window->cairo, window->font, &width, &height, config->pango_markup, "%s", line->text_line); - cairo_move_to(cairo, window->width - margin - width, margin); + cairo_move_to(cairo, (window->width * window->scale) + - margin - width, margin); pango_printf(window->cairo, window->font, config->pango_markup, "%s", line->text_line); } else if (line->protocol == I3BAR && line->block_line) { double pos = window->width - 0.5; @@ -315,12 +317,13 @@ void render(struct output *output, struct config *config, struct status_line *li } void set_window_height(struct window *window, int height) { - int text_width, text_height; - get_text_size(window->cairo, window->font, &text_width, &text_height, false, - "Test string for measuring purposes"); - if (height > 0) { - margin = (height - text_height) / 2; - ws_vertical_padding = margin - 1.5; - } - window->height = text_height + margin * 2; + int text_width, text_height; + get_text_size(window->cairo, window->font, + &text_width, &text_height, false, + "Test string for measuring purposes"); + if (height > 0) { + margin = (height - text_height) / 2; + ws_vertical_padding = margin - 1.5; + } + window->height = (text_height + margin * 2) / window->scale; } |