Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correctly scale swaybar #920

Merged
merged 1 commit into from
Sep 29, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions swaybar/render.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ static void render_block(struct window *window, struct config *config, struct st
// render background
if (block->background != 0x0) {
cairo_set_source_u32(window->cairo, block->background);
cairo_rectangle(window->cairo, pos - 0.5, 1, block_width, window->height - 2);
cairo_rectangle(window->cairo, pos - 0.5, 1, block_width, (window->height * window->scale) - 2);
cairo_fill(window->cairo);
}

Expand All @@ -110,7 +110,7 @@ static void render_block(struct window *window, struct config *config, struct st
if (block->border != 0 && block->border_bottom > 0) {
render_sharp_line(window->cairo, block->border,
pos - 0.5,
window->height - 1 - block->border_bottom,
(window->height * window->scale) - 1 - block->border_bottom,
block_width,
block->border_bottom);
}
Expand All @@ -121,7 +121,7 @@ static void render_block(struct window *window, struct config *config, struct st
pos - 0.5,
1,
block->border_left,
window->height - 2);
(window->height * window->scale) - 2);

pos += block->border_left + margin;
}
Expand Down Expand Up @@ -152,7 +152,7 @@ static void render_block(struct window *window, struct config *config, struct st
pos - 0.5,
1,
block->border_right,
window->height - 2);
(window->height * window->scale) - 2);

pos += block->border_right;
}
Expand All @@ -170,7 +170,7 @@ static void render_block(struct window *window, struct config *config, struct st
cairo_move_to(window->cairo, pos + block->separator_block_width/2,
margin);
cairo_line_to(window->cairo, pos + block->separator_block_width/2,
window->height - margin);
(window->height * window->scale) - margin);
cairo_stroke(window->cairo);
}
}
Expand Down Expand Up @@ -298,7 +298,7 @@ void render(struct output *output, struct config *config, struct status_line *li
pango_printf(window->cairo, window->font, window->scale,
config->pango_markup, "%s", line->text_line);
} else if (line->protocol == I3BAR && line->block_line) {
double pos = window->width - 0.5;
double pos = (window->width * window->scale) - 0.5;
bool edge = true;
for (i = line->block_line->length - 1; i >= 0; --i) {
struct status_block *block = line->block_line->items[i];
Expand Down