mirror of
https://github.com/labwc/labwc.git
synced 2025-10-29 05:40:24 -04:00
rcxml: fix broken OSD layout with multiple <fields> entries
Before this commit, all <field> entries inside different <fields> entires
were inserted to the same list. Suppose we have following configuration:
<windowSwitcher>
<fields><field content="title" width="100%" /></fields>
</windowSwitcher>
<windowSwitcher>
<fields><field content="identifier" width="100%" /></fields>
</windowSwitcher>
In this case, both two <field> 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 <windowSwitcher><fields>.
This commit is contained in:
parent
fcf230e692
commit
96a3a576a9
1 changed files with 12 additions and 5 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue