mirror of
https://github.com/labwc/labwc.git
synced 2025-11-04 13:30:07 -05:00
menu: consider padding when applying menu.width.{min,max}
This commit is contained in:
parent
ec520d3520
commit
3a7c6ce300
1 changed files with 6 additions and 7 deletions
|
|
@ -339,15 +339,14 @@ menu_update_scene(struct menu *menu)
|
||||||
menu->scene_tree = wlr_scene_tree_create(menu->server->menu_tree);
|
menu->scene_tree = wlr_scene_tree_create(menu->server->menu_tree);
|
||||||
wlr_scene_node_set_enabled(&menu->scene_tree->node, false);
|
wlr_scene_node_set_enabled(&menu->scene_tree->node, false);
|
||||||
|
|
||||||
/* Get widest menu item, clamped by menu_max_width */
|
/* Menu width is the maximum item width, capped by menu.width.{min,max} */
|
||||||
int max_width = theme->menu_min_width;
|
menu->size.width = 0;
|
||||||
wl_list_for_each(item, &menu->menuitems, link) {
|
wl_list_for_each(item, &menu->menuitems, link) {
|
||||||
if (item->native_width > max_width) {
|
menu->size.width = MAX(menu->size.width,
|
||||||
max_width = item->native_width < theme->menu_max_width
|
item->native_width + 2 * theme->menu_items_padding_x);
|
||||||
? item->native_width : theme->menu_max_width;
|
|
||||||
}
|
}
|
||||||
}
|
menu->size.width = MAX(menu->size.width, theme->menu_min_width);
|
||||||
menu->size.width = max_width + 2 * theme->menu_items_padding_x;
|
menu->size.width = MIN(menu->size.width, theme->menu_max_width);
|
||||||
|
|
||||||
/* Update all items for the new size */
|
/* Update all items for the new size */
|
||||||
int item_y = 0;
|
int item_y = 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue