rcxml: use fixed arrays for rc.title_buttons_*

These are just lists of enum lab_node_type, with a bounded size and
no middle-insertions/removals, so linked lists are overkill.

Also, the use of wl_list_for_each[_reverse] just to access the first or
last entry in the list (corner button) was weird.
This commit is contained in:
John Lindgren 2025-09-08 22:35:23 -04:00 committed by Johan Malm
parent e17ec0203c
commit bca0ec07ac
4 changed files with 38 additions and 57 deletions

View file

@ -14,6 +14,9 @@
#define BUTTON_MAP_MAX 16
/* max of one button of each type (no repeats) */
#define TITLE_BUTTONS_MAX ((LAB_NODE_BUTTON_LAST + 1) - LAB_NODE_BUTTON_FIRST)
enum adaptive_sync_mode {
LAB_ADAPTIVE_SYNC_DISABLED,
LAB_ADAPTIVE_SYNC_ENABLED,
@ -48,11 +51,6 @@ struct button_map_entry {
uint32_t to;
};
struct title_button {
enum lab_node_type type;
struct wl_list link;
};
struct usable_area_override {
struct border margin;
char *output;
@ -88,8 +86,12 @@ struct rcxml {
char *theme_name;
char *icon_theme_name;
char *fallback_app_icon_name;
struct wl_list title_buttons_left;
struct wl_list title_buttons_right;
enum lab_node_type title_buttons_left[TITLE_BUTTONS_MAX];
int nr_title_buttons_left;
enum lab_node_type title_buttons_right[TITLE_BUTTONS_MAX];
int nr_title_buttons_right;
int corner_radius;
bool show_title;
bool title_layout_loaded;