menu: fix pipemenu bug causing parent menu to disappear

...introduced by 7651531632

Only post-process the pipemenu instead of processing all menus because
post_processing() calls menu_update_scene() which is a bit heavier than
its predecessor and calls wlr_scene_node_set_enabled() which disables
existing menus.
This commit is contained in:
Johan Malm 2024-11-13 21:11:35 +00:00
parent d7e6f3a7a8
commit e95bff7be0

View file

@ -367,6 +367,21 @@ menu_update_scene(struct menu *menu)
menu->size.height = item_y;
}
static void
post_processing_from(struct server *server, struct menu *from)
{
bool should_process = false;
struct menu *menu;
wl_list_for_each(menu, &server->menus, link) {
if (menu == from) {
should_process = true;
}
if (should_process) {
menu_update_scene(menu);
}
}
}
static void
post_processing(struct server *server)
{
@ -1359,18 +1374,14 @@ create_pipe_menu(struct menu_pipe_context *ctx)
}
ctx->item->submenu = pipe_menu;
/*
* TODO: refactor validate() and post_processing() to only
* operate from current point onwards
*/
/* Set menu-widths before configuring */
post_processing(ctx->server);
post_processing_from(ctx->server, pipe_menu);
enum menu_align align = ctx->item->parent->align;
struct wlr_box pos = get_submenu_position(ctx->item, align);
menu_configure(pipe_menu, pos.x, pos.y, align);
/*TODO: refactor validate() to only operate from current point onwards */
validate(ctx->server);
/* Finally open the new submenu tree */