From 0aaa2e0102c96e64f9a4a23c30ab38df9bb0a1c0 Mon Sep 17 00:00:00 2001 From: tokyo4j Date: Fri, 8 Nov 2024 20:55:13 +0900 Subject: [PATCH] menu: correctly center menu opened with Prior to this commit, a menu opened with: was not correctly centered when menu.items.padding.x is non-zero. --- src/action.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/action.c b/src/action.c index 0afce126..3df81df2 100644 --- a/src/action.c +++ b/src/action.c @@ -688,19 +688,9 @@ show_menu(struct server *server, struct view *view, struct cursor_context *ctx, if (pos_x && pos_y) { struct output *output = output_nearest_to(server, server->seat.cursor->x, server->seat.cursor->y); - struct menuitem *item; - struct theme *theme = server->theme; - int max_width = theme->menu_min_width; - - wl_list_for_each(item, &menu->menuitems, link) { - if (item->native_width > max_width) { - max_width = item->native_width < theme->menu_max_width - ? item->native_width : theme->menu_max_width; - } - } if (!strcasecmp(pos_x, "center")) { - x = (output->usable_area.width / 2) - (max_width / 2); + x = (output->usable_area.width - menu->size.width) / 2; } else if (strchr(pos_x, '%')) { x = (output->usable_area.width * atoi(pos_x)) / 100; } else {