menu: dynamically generate top-level pipemenus

This eliminates code duplications and aligns the behavior of top-level
pipemenus with sub-pipemenus.
This commit is contained in:
tokyo4j 2025-03-10 16:52:52 +09:00 committed by Johan Malm
parent 40dfee7bd5
commit 54186e5152
2 changed files with 75 additions and 162 deletions

View file

@ -20,8 +20,6 @@ enum menuitem_type {
struct menuitem {
struct wl_list actions;
char *execute;
char *id; /* needed for pipemenus */
char *text;
char *icon_name;
const char *arrow;
@ -33,7 +31,6 @@ struct menuitem {
struct wlr_scene_tree *tree;
struct wlr_scene_tree *normal_tree;
struct wlr_scene_tree *selected_tree;
struct menu_pipe_context *pipe_ctx;
struct view *client_list_view; /* used by internal client-list */
struct wl_list link; /* menu.menuitems */
};
@ -43,6 +40,7 @@ struct menu {
char *id;
char *label;
char *icon_name;
char *execute;
struct menu *parent;
struct menu_pipe_context *pipe_ctx;
@ -57,7 +55,7 @@ struct menu {
struct menuitem *item;
} selection;
struct wlr_scene_tree *scene_tree;
bool is_pipemenu;
bool is_pipemenu_child;
bool align_left;
bool has_icons;