mirror of
https://github.com/swaywm/sway.git
synced 2024-12-29 16:36:26 +01:00
swaybar: make status block text render in the same way as others
Other components like workspace button, status line (error or plain text) already render text at integer coords. This make status block also render text at integer coords.
This commit is contained in:
parent
fba248ed5e
commit
3a2e860848
1 changed files with 4 additions and 2 deletions
|
@ -263,7 +263,8 @@ static uint32_t render_status_block(cairo_t *cairo,
|
||||||
} else if (strncmp(block->align, "center", 6) == 0) {
|
} else if (strncmp(block->align, "center", 6) == 0) {
|
||||||
offset = x_pos + (width - text_width) / 2;
|
offset = x_pos + (width - text_width) / 2;
|
||||||
}
|
}
|
||||||
cairo_move_to(cairo, offset, height / 2.0 - text_height / 2.0);
|
double text_y = height / 2.0 - text_height / 2.0;
|
||||||
|
cairo_move_to(cairo, offset, (int)floor(text_y));
|
||||||
uint32_t color = block->color ? *block->color : config->colors.statusline;
|
uint32_t color = block->color ? *block->color : config->colors.statusline;
|
||||||
color = block->urgent ? config->colors.urgent_workspace.text : color;
|
color = block->urgent ? config->colors.urgent_workspace.text : color;
|
||||||
cairo_set_source_u32(cairo, color);
|
cairo_set_source_u32(cairo, color);
|
||||||
|
@ -286,7 +287,8 @@ static uint32_t render_status_block(cairo_t *cairo,
|
||||||
}
|
}
|
||||||
if (config->sep_symbol) {
|
if (config->sep_symbol) {
|
||||||
offset = x_pos + (sep_block_width - sep_width) / 2;
|
offset = x_pos + (sep_block_width - sep_width) / 2;
|
||||||
cairo_move_to(cairo, offset, height / 2.0 - sep_height / 2.0);
|
double sep_y = height / 2.0 - sep_height / 2.0;
|
||||||
|
cairo_move_to(cairo, offset, (int)floor(sep_y));
|
||||||
pango_printf(cairo, config->font, output->scale, false,
|
pango_printf(cairo, config->font, output->scale, false,
|
||||||
"%s", config->sep_symbol);
|
"%s", config->sep_symbol);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue