diff options
author | D.B <thejan.2009@gmail.com> | 2016-09-29 14:31:35 +0200 |
---|---|---|
committer | D.B <thejan.2009@gmail.com> | 2016-09-29 14:31:35 +0200 |
commit | fe89d7fba36ee17b3adb0f7871c167b38203fde6 (patch) | |
tree | 4ef18cd9a7dcd63aec70dacadc40c6a549881ed6 /swaybar | |
parent | Merge pull request #911 from thejan2009/setgid-setuid (diff) | |
download | sway-fe89d7fba36ee17b3adb0f7871c167b38203fde6.tar.gz sway-fe89d7fba36ee17b3adb0f7871c167b38203fde6.tar.zst sway-fe89d7fba36ee17b3adb0f7871c167b38203fde6.zip |
Correctly scale swaybar
Fixes #910. There were some missing multiplications with window->scale.
Diffstat (limited to 'swaybar')
-rw-r--r-- | swaybar/render.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/swaybar/render.c b/swaybar/render.c index 7bc060d5..a773df7b 100644 --- a/swaybar/render.c +++ b/swaybar/render.c | |||
@@ -93,7 +93,7 @@ static void render_block(struct window *window, struct config *config, struct st | |||
93 | // render background | 93 | // render background |
94 | if (block->background != 0x0) { | 94 | if (block->background != 0x0) { |
95 | cairo_set_source_u32(window->cairo, block->background); | 95 | cairo_set_source_u32(window->cairo, block->background); |
96 | cairo_rectangle(window->cairo, pos - 0.5, 1, block_width, window->height - 2); | 96 | cairo_rectangle(window->cairo, pos - 0.5, 1, block_width, (window->height * window->scale) - 2); |
97 | cairo_fill(window->cairo); | 97 | cairo_fill(window->cairo); |
98 | } | 98 | } |
99 | 99 | ||
@@ -110,7 +110,7 @@ static void render_block(struct window *window, struct config *config, struct st | |||
110 | if (block->border != 0 && block->border_bottom > 0) { | 110 | if (block->border != 0 && block->border_bottom > 0) { |
111 | render_sharp_line(window->cairo, block->border, | 111 | render_sharp_line(window->cairo, block->border, |
112 | pos - 0.5, | 112 | pos - 0.5, |
113 | window->height - 1 - block->border_bottom, | 113 | (window->height * window->scale) - 1 - block->border_bottom, |
114 | block_width, | 114 | block_width, |
115 | block->border_bottom); | 115 | block->border_bottom); |
116 | } | 116 | } |
@@ -121,7 +121,7 @@ static void render_block(struct window *window, struct config *config, struct st | |||
121 | pos - 0.5, | 121 | pos - 0.5, |
122 | 1, | 122 | 1, |
123 | block->border_left, | 123 | block->border_left, |
124 | window->height - 2); | 124 | (window->height * window->scale) - 2); |
125 | 125 | ||
126 | pos += block->border_left + margin; | 126 | pos += block->border_left + margin; |
127 | } | 127 | } |
@@ -152,7 +152,7 @@ static void render_block(struct window *window, struct config *config, struct st | |||
152 | pos - 0.5, | 152 | pos - 0.5, |
153 | 1, | 153 | 1, |
154 | block->border_right, | 154 | block->border_right, |
155 | window->height - 2); | 155 | (window->height * window->scale) - 2); |
156 | 156 | ||
157 | pos += block->border_right; | 157 | pos += block->border_right; |
158 | } | 158 | } |
@@ -170,7 +170,7 @@ static void render_block(struct window *window, struct config *config, struct st | |||
170 | cairo_move_to(window->cairo, pos + block->separator_block_width/2, | 170 | cairo_move_to(window->cairo, pos + block->separator_block_width/2, |
171 | margin); | 171 | margin); |
172 | cairo_line_to(window->cairo, pos + block->separator_block_width/2, | 172 | cairo_line_to(window->cairo, pos + block->separator_block_width/2, |
173 | window->height - margin); | 173 | (window->height * window->scale) - margin); |
174 | cairo_stroke(window->cairo); | 174 | cairo_stroke(window->cairo); |
175 | } | 175 | } |
176 | } | 176 | } |
@@ -298,7 +298,7 @@ void render(struct output *output, struct config *config, struct status_line *li | |||
298 | pango_printf(window->cairo, window->font, window->scale, | 298 | pango_printf(window->cairo, window->font, window->scale, |
299 | config->pango_markup, "%s", line->text_line); | 299 | config->pango_markup, "%s", line->text_line); |
300 | } else if (line->protocol == I3BAR && line->block_line) { | 300 | } else if (line->protocol == I3BAR && line->block_line) { |
301 | double pos = window->width - 0.5; | 301 | double pos = (window->width * window->scale) - 0.5; |
302 | bool edge = true; | 302 | bool edge = true; |
303 | for (i = line->block_line->length - 1; i >= 0; --i) { | 303 | for (i = line->block_line->length - 1; i >= 0; --i) { |
304 | struct status_block *block = line->block_line->items[i]; | 304 | struct status_block *block = line->block_line->items[i]; |