]> git.mdlowis.com Git - proto/labwc.git/commitdiff
config: remove is_attribute
authorJohan Malm <jgm323@gmail.com>
Wed, 22 Sep 2021 19:25:57 +0000 (20:25 +0100)
committerJohan Malm <jgm323@gmail.com>
Wed, 22 Sep 2021 19:25:57 +0000 (20:25 +0100)
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>

src/config/rcxml.c

index 3de08f19b3817d4a14dd48821a34f89b45acd082..53c333491ef0a7059537b5448d29a12e3e86caeb 100644 (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);
 }