menu: use "MenuHeader" font height in separators with label

This commit is contained in:
Tomi Ollila 2024-10-26 17:14:27 +03:00 committed by Johan Malm
parent 6cb8f18fe1
commit ad2d24fb42
3 changed files with 8 additions and 3 deletions

View 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];

View 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;

View 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;