theme: add menu.overlap.{x,y}

This commit is contained in:
Johan Malm 2021-11-08 17:36:39 +00:00
parent cd31283ba3
commit dd1663e627
5 changed files with 30 additions and 5 deletions

View file

@ -276,6 +276,8 @@ err:
static void
menu_configure(struct menu *menu, int x, int y)
{
struct theme *theme = menu->server->theme;
menu->box.x = x;
menu->box.y = y;
@ -286,10 +288,9 @@ menu_configure(struct menu *menu, int x, int y)
menuitem->box.y = menu->box.y + offset;
offset += menuitem->box.height;
if (menuitem->submenu) {
/* TODO: add offset to rc.xml */
menu_configure(menuitem->submenu,
menuitem->box.x + MENUWIDTH + 10,
menuitem->box.y);
menu_configure(menuitem->submenu, menuitem->box.x
+ MENUWIDTH - theme->menu_overlap_x,
menuitem->box.y + theme->menu_overlap_y);
}
}

View file

@ -91,6 +91,8 @@ theme_builtin(struct theme *theme)
{
theme->border_width = 1;
theme->padding_height = 3;
theme->menu_overlap_x = 0;
theme->menu_overlap_y = 0;
parse_hexstr("#dddad6", theme->window_active_border_color);
parse_hexstr("#f6f5f4", theme->window_inactive_border_color);
@ -152,6 +154,12 @@ entry(struct theme *theme, const char *key, const char *value)
if (match(key, "padding.height")) {
theme->padding_height = atoi(value);
}
if (match(key, "menu.overlap.x")) {
theme->menu_overlap_x = atoi(value);
}
if (match(key, "menu.overlap.y")) {
theme->menu_overlap_y = atoi(value);
}
if (match(key, "window.active.border.color")) {
parse_hexstr(value, theme->window_active_border_color);