From: tokyo4j Date: Sat, 12 Apr 2025 11:51:02 +0000 (+0900) Subject: rcxml: fix broken OSD layout with multiple entries X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=96a3a576a9547cb177ad28a158f6ac63283a421b;p=proto%2Flabwc.git rcxml: fix broken OSD layout with multiple entries Before this commit, all entries inside different entires were inserted to the same list. Suppose we have following configuration: In this case, both two entries were inserted to rc.window_switcher.fields, making the OSD content overflow. This commit fixes by clearing rc.window_switcher.fields when the parser encounters . --- diff --git a/src/config/rcxml.c b/src/config/rcxml.c index c1b3f5b3..cad132f8 100644 --- a/src/config/rcxml.c +++ b/src/config/rcxml.c @@ -358,6 +358,16 @@ fill_window_rule(char *nodename, char *content, struct parser_state *state) } } +static void +clear_window_switcher_fields(void) +{ + struct window_switcher_field *field, *field_tmp; + wl_list_for_each_safe(field, field_tmp, &rc.window_switcher.fields, link) { + wl_list_remove(&field->link); + osd_field_free(field); + } +} + static void fill_window_switcher_field(char *nodename, char *content, struct parser_state *state) { @@ -1381,6 +1391,7 @@ xml_tree_walk(xmlNode *node, struct parser_state *state) continue; } if (!strcasecmp((char *)n->name, "fields")) { + clear_window_switcher_fields(); state->in_window_switcher_field = true; traverse(n, state); state->in_window_switcher_field = false; @@ -2042,11 +2053,7 @@ rcxml_finish(void) regions_destroy(NULL, &rc.regions); - struct window_switcher_field *field, *field_tmp; - wl_list_for_each_safe(field, field_tmp, &rc.window_switcher.fields, link) { - wl_list_remove(&field->link); - osd_field_free(field); - } + clear_window_switcher_fields(); struct window_rule *rule, *rule_tmp; wl_list_for_each_safe(rule, rule_tmp, &rc.window_rules, link) {