]> git.mdlowis.com Git - proto/labwc.git/commitdiff
menu: use "MenuHeader" font height in separators with label
authorTomi Ollila <tomi.ollila@iki.fi>
Sat, 26 Oct 2024 14:14:27 +0000 (17:14 +0300)
committerJohan Malm <johanmalm@users.noreply.github.com>
Mon, 28 Oct 2024 19:06:32 +0000 (19:06 +0000)
include/theme.h
src/menu/menu.c
src/theme.c

index 2b6006766b2333a8c16352c55b7068d30a5b02d9..379c4d889c66722694fdca15d3f8df5d5604300c 100644 (file)
@@ -74,6 +74,8 @@ struct theme {
        int menu_item_padding_y;
        int menu_item_height;
 
+       int menu_header_height;
+
        float menu_items_bg_color[4];
        float menu_items_text_color[4];
        float menu_items_active_bg_color[4];
index 6092ce9e61981e56c151ec3fab3a4c28128b4c29..da7289e8cbcaa07f2c840c91e47d084a7a1d66fe 100644 (file)
@@ -152,7 +152,7 @@ menu_update_width(struct menu *menu)
                                int x, y;
                                x = (menu->size.width - item->native_width) / 2;
                                x = x < 0 ? 0 : x;
-                               y = (theme->menu_item_height - item->normal.buffer->height) / 2;
+                               y = (theme->menu_header_height - item->normal.buffer->height) / 2;
                                wlr_scene_node_set_position(item->normal.text, x, y);
                        }
                }
@@ -308,7 +308,7 @@ separator_create(struct menu *menu, const char *label)
        struct theme *theme = server->theme;
 
        if (menuitem->type == LAB_MENU_TITLE) {
-               menuitem->height = theme->menu_item_height;
+               menuitem->height = theme->menu_header_height;
                menuitem->native_width = font_width(&rc.font_menuheader, label);
        } else if (menuitem->type == LAB_MENU_SEPARATOR_LINE) {
                menuitem->height = theme->menu_separator_line_thickness +
@@ -349,7 +349,7 @@ separator_create(struct menu *menu, const char *label)
                /* Center font nodes */
                int x, y;
                x = theme->menu_item_padding_x;
-               y = (theme->menu_item_height - menuitem->normal.buffer->height) / 2;
+               y = (theme->menu_header_height - menuitem->normal.buffer->height) / 2;
                wlr_scene_node_set_position(menuitem->normal.text, x, y);
        } else {
                int nominal_width = theme->menu_min_width;
index c0af2ad604f5759e087ac14b2a7ff85966dd3549..1a0b974e2cf22d46965c6be0d7f232007daa1e4f 100644 (file)
@@ -1480,6 +1480,9 @@ post_processing(struct theme *theme)
        theme->menu_item_height = font_height(&rc.font_menuitem)
                + 2 * theme->menu_item_padding_y;
 
+       theme->menu_header_height = font_height(&rc.font_menuheader)
+               + 2 * theme->menu_item_padding_y;
+
        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_active_border_width;