config: remove is_attribute

Simplify code, by removing the ability to differentiate between
attributes and sub-elements when creating node names. For example,
the following two examples would generate the nodename `bar.foo`

- <bar><foo></foo></bar>
- <bar foo="">

In theory, there could be clashes, but I think in reality it is unlikely.
There are no clashes in openbox-spec and it would be pretty confusing to
have something like:

<font name="">
  <name></name>
</font>
This commit is contained in:
Johan Malm 2021-09-22 20:25:57 +01:00
parent b5addb62e0
commit e1c1b4544d

View file

@ -22,7 +22,6 @@
static bool in_keybind = false;
static bool in_mousebind = false;
static bool is_attribute = false;
static struct keybind *current_keybind;
static struct mousebind *current_mousebind;
static const char *current_mouse_context;
@ -185,9 +184,6 @@ entry(xmlNode *node, char *nodename, char *content)
string_truncate_at_pattern(nodename, ".labwc_config");
if (getenv("LABWC_DEBUG_CONFIG_NODENAMES")) {
if (is_attribute) {
printf("@");
}
printf("%s: %s\n", nodename, content);
}
@ -208,7 +204,7 @@ entry(xmlNode *node, char *nodename, char *content)
if (!content) {
return;
}
if (is_attribute && !strcmp(nodename, "place.font.theme")) {
if (!strcmp(nodename, "place.font.theme")) {
font_place = enum_font_place(content);
}
@ -251,8 +247,7 @@ entry(xmlNode *node, char *nodename, char *content)
if (valid_doubleclick_time) {
rc.doubleclick_time = doubleclick_time_parsed;
}
} else if (is_attribute &&
!strcasecmp(nodename, "name.context.mouse")) {
} else if (!strcasecmp(nodename, "name.context.mouse")) {
current_mouse_context = content;
}
}
@ -278,11 +273,9 @@ static void
traverse(xmlNode *n)
{
process_node(n);
is_attribute = true;
for (xmlAttr *attr = n->properties; attr; attr = attr->next) {
xml_tree_walk(attr->children);
}
is_attribute = false;
xml_tree_walk(n->children);
}