menu: use wl_list instead of array

...to make it easier to split menu.c into smaller chunks without
exposing nr_menus variable.
This commit is contained in:
Johan Malm 2023-10-09 20:59:04 +01:00 committed by Johan Malm
parent b22722dafa
commit a105c8781a
5 changed files with 29 additions and 38 deletions

View file

@ -60,6 +60,7 @@ struct menu {
/* Used to match a window-menu to the view that triggered it. */
struct view *triggered_by_view; /* may be NULL */
struct wl_list link; /* server.menus */
};
/* For keyboard support */
@ -70,14 +71,14 @@ void menu_submenu_leave(struct server *server);
bool menu_call_selected_actions(struct server *server);
void menu_init(struct server *server);
void menu_finish(void);
void menu_finish(struct server *server);
/**
* menu_get_by_id - get menu by id
*
* @id id string defined in menu.xml like "root-menu"
*/
struct menu *menu_get_by_id(const char *id);
struct menu *menu_get_by_id(struct server *server, const char *id);
/**
* menu_open - open menu on position (x, y)