]> git.mdlowis.com Git - proto/labwc.git/commitdiff
osd: make item-border part of item-height
authorJohan Malm <jgm323@gmail.com>
Wed, 5 Jul 2023 18:49:56 +0000 (19:49 +0100)
committerJohan Malm <johanmalm@users.noreply.github.com>
Wed, 5 Jul 2023 20:31:30 +0000 (21:31 +0100)
src/osd.c
src/theme.c

index f011259cd59701d0ea61a256339d732a2834d201..7b9f89d64ff0d2c70874eebd7a9c273d2bd15110 100644 (file)
--- a/src/osd.c
+++ b/src/osd.c
@@ -324,7 +324,7 @@ render_osd(struct server *server, cairo_t *cairo, int w, int h,
                /* Center workspace indicator on the x axis */
                int x = font_width(&rc.font_osd, workspace_name);
                x = (theme->osd_window_switcher_width - x) / 2;
-               cairo_move_to(cairo, x, y);
+               cairo_move_to(cairo, x, y + theme->osd_window_switcher_item_active_border_width);
                PangoWeight weight = pango_font_description_get_weight(desc);
                pango_font_description_set_weight(desc, PANGO_WEIGHT_BOLD);
                pango_layout_set_font_description(layout, desc);
@@ -372,17 +372,18 @@ render_osd(struct server *server, cairo_t *cairo, int w, int h,
                 * |                                 |
                 * +---------------------------------+
                 */
-               y += theme->osd_border_width;
-               int x = theme->osd_window_switcher_item_padding_x
-                       + 2 * theme->osd_border_width
-                       + theme->osd_window_switcher_padding;
+               int x = theme->osd_border_width
+                       + theme->osd_window_switcher_padding
+                       + theme->osd_window_switcher_item_active_border_width
+                       + theme->osd_window_switcher_item_padding_x;
 
                int nr_fields = wl_list_length(&rc.window_switcher.fields);
                struct window_switcher_field *field;
                wl_list_for_each(field, &rc.window_switcher.fields, link) {
                        buf.len = 0;
-                       cairo_move_to(cairo, x,
-                               y + theme->osd_window_switcher_item_padding_y - 1);
+                       cairo_move_to(cairo, x, y
+                               + theme->osd_window_switcher_item_padding_y
+                               + theme->osd_window_switcher_item_active_border_width);
 
                        switch (field->content) {
                        case LAB_FIELD_TYPE:
@@ -410,19 +411,18 @@ render_osd(struct server *server, cairo_t *cairo, int w, int h,
                        /* Highlight current window */
                        struct wlr_fbox fbox = {
                                .x = theme->osd_border_width + theme->osd_window_switcher_padding,
-                               .y = y - theme->osd_window_switcher_item_active_border_width,
+                               .y = y,
                                .width = theme->osd_window_switcher_width
                                        - 2 * theme->osd_border_width
                                        - 2 * theme->osd_window_switcher_padding,
-                               .height = theme->osd_window_switcher_item_height
-                                       + theme->osd_window_switcher_item_active_border_width,
+                               .height = theme->osd_window_switcher_item_height,
                        };
                        draw_cairo_border(cairo, fbox,
                                theme->osd_window_switcher_item_active_border_width);
                        cairo_stroke(cairo);
                }
 
-               y += theme->osd_border_width + theme->osd_window_switcher_item_height;
+               y += theme->osd_window_switcher_item_height;
        }
        free(buf.buf);
        g_object_unref(layout);
index f8bfa6154c561e86fe0e3fe1cb55a6889b956aab..8e5b7f8077f656872abf6d9195b1adfa677b2676 100644 (file)
@@ -540,7 +540,8 @@ post_processing(struct theme *theme)
        theme->title_height = font_height(&rc.font_activewindow)
                + 2 * theme->padding_height;
        theme->osd_window_switcher_item_height = font_height(&rc.font_osd)
-               + 2 * theme->osd_window_switcher_item_padding_y;
+               + 2 * theme->osd_window_switcher_item_padding_y
+               + 2 * theme->osd_window_switcher_item_active_border_width;
 
        if (rc.corner_radius >= theme->title_height) {
                theme->title_height = rc.corner_radius + 1;