mirror of
https://github.com/labwc/labwc.git
synced 2025-10-31 22:25:34 -04:00
rcxml: fix broken titlebar layout with multiple <layout> entries
Before this commit, when we have multiple <theme><titlebar><layout>
entries like below, duplicated button types can be inserted to
rc.title_buttons_{left,right} and the button could go outside of the
window:
<theme>
<titlebar><layout>icon:iconify,max,close</layout></titlebar>
<titlebar><layout>icon:iconify,max,close</layout></titlebar>
</theme>
This commit fixes by clearing those lists when the parser encounters
<theme><titlebar><layout>.
This commit is contained in:
parent
be3ca8df7a
commit
fcf230e692
1 changed files with 18 additions and 9 deletions
|
|
@ -201,9 +201,26 @@ fill_section(const char *content, struct wl_list *list, uint32_t *found_buttons)
|
|||
g_strfreev(identifiers);
|
||||
}
|
||||
|
||||
static void
|
||||
clear_title_layout(void)
|
||||
{
|
||||
struct title_button *button, *button_tmp;
|
||||
wl_list_for_each_safe(button, button_tmp, &rc.title_buttons_left, link) {
|
||||
wl_list_remove(&button->link);
|
||||
zfree(button);
|
||||
}
|
||||
wl_list_for_each_safe(button, button_tmp, &rc.title_buttons_right, link) {
|
||||
wl_list_remove(&button->link);
|
||||
zfree(button);
|
||||
}
|
||||
rc.title_layout_loaded = false;
|
||||
}
|
||||
|
||||
static void
|
||||
fill_title_layout(char *content)
|
||||
{
|
||||
clear_title_layout();
|
||||
|
||||
struct wl_list *sections[] = {
|
||||
&rc.title_buttons_left,
|
||||
&rc.title_buttons_right,
|
||||
|
|
@ -1978,15 +1995,7 @@ rcxml_finish(void)
|
|||
zfree(rc.workspace_config.prefix);
|
||||
zfree(rc.tablet.output_name);
|
||||
|
||||
struct title_button *p, *p_tmp;
|
||||
wl_list_for_each_safe(p, p_tmp, &rc.title_buttons_left, link) {
|
||||
wl_list_remove(&p->link);
|
||||
zfree(p);
|
||||
}
|
||||
wl_list_for_each_safe(p, p_tmp, &rc.title_buttons_right, link) {
|
||||
wl_list_remove(&p->link);
|
||||
zfree(p);
|
||||
}
|
||||
clear_title_layout();
|
||||
|
||||
struct usable_area_override *area, *area_tmp;
|
||||
wl_list_for_each_safe(area, area_tmp, &rc.usable_area_overrides, link) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue