osd: fix boxes size and alignment in workspace switcher

Workspace switcher boxes height was 2px more than supposed,
e.g. theme defaults of 20x20 resulted in 20x22 boxes.

The middle of the boxes list was also 1px to the left of the middle
of the osd window.
This commit is contained in:
Dmitry 2025-04-06 14:49:11 +04:00
parent 44146487b2
commit 4f3c0a0b55

View file

@ -114,12 +114,16 @@ _osd_update(struct server *server)
wl_list_for_each(workspace, &server->workspaces.all, link) { wl_list_for_each(workspace, &server->workspaces.all, link) {
bool active = workspace == server->workspaces.current; bool active = workspace == server->workspaces.current;
set_cairo_color(cairo, server->theme->osd_label_text_color); set_cairo_color(cairo, server->theme->osd_label_text_color);
cairo_rectangle(cairo, x, margin, struct wlr_fbox fbox = {
rect_width - padding, rect_height); .x = x,
cairo_stroke(cairo); .y = margin,
.width = rect_width,
.height = rect_height,
};
draw_cairo_border(cairo, fbox, 2);
if (active) { if (active) {
cairo_rectangle(cairo, x, margin, cairo_rectangle(cairo, x, margin,
rect_width - padding, rect_height); rect_width, rect_height);
cairo_fill(cairo); cairo_fill(cairo);
} }
x += rect_width + padding; x += rect_width + padding;