menu: fix the calculation for centered titles

This commit is contained in:
tokyo4j 2024-10-20 15:16:57 +09:00
parent a567b4dc3b
commit 2806ad5d7d

View file

@ -150,8 +150,7 @@ menu_update_width(struct menu *menu)
}
if (theme->menu_title_text_justify == LAB_JUSTIFY_CENTER) {
int x, y;
x = (max_width - theme->menu_item_padding_x -
item->native_width) / 2;
x = (menu->size.width - item->native_width) / 2;
x = x < 0 ? 0 : x;
y = (theme->menu_item_height - item->normal.buffer->height) / 2;
wlr_scene_node_set_position(item->normal.text, x, y);