menu: some refactor

- Don't store font/background buffers in menuitem struct since we no
  longer dynamically update buffers of existing menuitems.
- Factor out the duplicated codes for creating menu item scenes for each
  unselected/selected states.
This commit is contained in:
tokyo4j 2024-12-03 15:58:07 +09:00 committed by Johan Malm
parent f5d706bae3
commit 10fc656c23
2 changed files with 62 additions and 74 deletions

View file

@ -20,13 +20,6 @@ enum menu_align {
LAB_MENU_OPEN_BOTTOM = 1 << 3,
};
struct menu_scene {
struct wlr_scene_tree *tree;
struct wlr_scene_node *text;
struct wlr_scene_node *background;
struct scaled_font_buffer *buffer;
};
enum menuitem_type {
LAB_MENU_ITEM = 0,
LAB_MENU_SEPARATOR_LINE,
@ -45,8 +38,8 @@ struct menuitem {
enum menuitem_type type;
int native_width;
struct wlr_scene_tree *tree;
struct menu_scene normal;
struct menu_scene selected;
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 */