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 committed by Johan Malm
parent 96a3a576a9
commit 79b92d821f

View file

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