struct buf *buf, struct view *view);
/* Used by rcxml.c when parsing the config */
-struct window_switcher_field *osd_field_create(void);
void osd_field_arg_from_xml_node(struct window_switcher_field *field,
const char *nodename, const char *content);
bool osd_field_is_valid(struct window_switcher_field *field);
}
static void
-fill_window_switcher_field(char *nodename, char *content, struct parser_state *state)
+fill_window_switcher_field(xmlNode *node)
{
- if (!strcasecmp(nodename, "field.fields.windowswitcher")) {
- state->current_field = osd_field_create();
- wl_list_append(&rc.window_switcher.fields, &state->current_field->link);
- return;
+ struct window_switcher_field *field = znew(*field);
+ wl_list_append(&rc.window_switcher.fields, &field->link);
+
+ xmlNode *child;
+ char *key, *content;
+ LAB_XML_FOR_EACH(node, child, key, content) {
+ osd_field_arg_from_xml_node(field, key, content);
}
+}
- string_truncate_at_pattern(nodename, ".field.fields.windowswitcher");
- if (!content) {
- /* intentionally left empty */
- } else if (!state->current_field) {
- wlr_log(WLR_ERROR, "no <field>");
- } else {
- osd_field_arg_from_xml_node(state->current_field, nodename, content);
+static void
+fill_window_switcher_fields(xmlNode *node)
+{
+ clear_window_switcher_fields();
+
+ xmlNode *child;
+ char *key, *content;
+ LAB_XML_FOR_EACH(node, child, key, content) {
+ if (!strcasecmp(key, "field")) {
+ fill_window_switcher_field(child);
+ }
}
}
fill_regions(node);
return;
}
- if (state->in_window_switcher_field) {
- fill_window_switcher_field(nodename, content, state);
+ if (!strcasecmp(nodename, "fields.windowSwitcher")) {
+ fill_window_switcher_fields(node);
return;
}
if (state->in_window_rules) {
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;