]> git.mdlowis.com Git - proto/labwc.git/commitdiff
osd: fix boxes size and alignment in workspace switcher
authorDmitry <deekovalev@gmail.com>
Sun, 6 Apr 2025 10:49:11 +0000 (14:49 +0400)
committerJohan Malm <johanmalm@users.noreply.github.com>
Mon, 14 Apr 2025 19:06:38 +0000 (20:06 +0100)
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

index b17f986e0b644492bdb5053ad4d15fbf61716256..ec7106e1f9e25fa35f62127f31196cbec36b5203 100644 (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;