From 79b92d821f897aaca22a5f8c03885f721c8b7ad9 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Sun, 6 Apr 2025 14:49:11 +0400 Subject: [PATCH] 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. --- src/workspaces.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/workspaces.c b/src/workspaces.c index b17f986e..ec7106e1 100644 --- a/src/workspaces.c +++ b/src/workspaces.c @@ -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;