]> git.mdlowis.com Git - proto/labwc.git/commitdiff
rcxml: discourage empty strings in rc.xml configuration
authortokyo4j <hrak1529@gmail.com>
Wed, 3 Dec 2025 09:26:44 +0000 (18:26 +0900)
committerHiroaki Yamamoto <hrak1529@gmail.com>
Wed, 3 Dec 2025 20:02:26 +0000 (05:02 +0900)
Background:
I rewrote the config parser in 9462457..2f414a4, but it broke certain
configurations by changing how empty strings are handled: they were mostly
just ignored before my parser rewrite, but after that, they are
interpreted as just empty strings (output="" is considered as 'output named ""').

Though that was unintentional, I believe ignoring empty strings was not a
good idea in the first place, as we already allow empty strings for
certain configurations (e.g. `<desktop prefix="">`), which makes the
parser's behavior inconsistent.

Change:
So let's clarify that we intend to read empty strings as empty strings.
As a preparation, this commit adds warnings for empty strings we are
currently ignoring, so that users can be informed that we intend to just
read empty strings (e.g. `<theme name="">`) as empty strings in the future.
I removed existing empty strings in `rc.xml.all` to avoid warnings when
reading it.

docs/rc.xml.all
src/config/rcxml.c

index 97698aac23a5eb5f8f56fb58d7a91929ba247a9d..cd73f61e84efedfbf5bba2af161d9eace10eb03b 100644 (file)
@@ -33,8 +33,8 @@
 
   <!-- <font><theme> can be defined without an attribute to set all places -->
   <theme>
-    <name></name>
-    <icon></icon>
+    <!-- <name>Numix</name> -->
+    <!-- <icon>breeze</icon> -->
     <fallbackAppIcon>labwc</fallbackAppIcon>
     <titlebar>
       <layout>icon:iconify,max,close</layout>
     space automatically, so <margin> is only intended for other, specialist
     cases.
 
-    If output is left empty, the margin will be applied to all outputs.
+    If 'output' is not provided, the margin will be applied to all outputs.
 
-    <margin top="" bottom="" left="" right="" output="" />
+    <margin top="10" bottom="10" left="10" right="10" output="HDMI-A-1" />
   -->
 
   <!-- Percent based regions based on output usable area, % char is required -->
     If mouseEmulation is enabled, all touch up/down/motion events are
     translated to mouse button and motion events.
   -->
-  <touch deviceName="" mapToOutput="" mouseEmulation="no"/>
+  <touch>
+    <!-- <deviceName>ELAN2514:00 04F3:2AF1<deviceName> -->
+    <!-- <mapToOutput>HDMI-A-1</mapToOutput> -->
+    <mouseEmulation>no</mouseEmulation>
+  </touch>
 
   <!--
     The tablet cursor movement can be restricted to a single output.
     When using mouse emulation, the pen tip [tip] and the stylus buttons
     can be set to any available mouse button [Left|Right|Middle|..|Task].
   -->
-  <tablet mapToOutput="" rotate="0" mouseEmulation="no">
+  <tablet rotate="0" mouseEmulation="no">
+    <!-- <mapToOutput>HDMI-A-1</mapToOutput> -->
     <!-- Active area dimensions are in mm -->
     <area top="0.0" left="0.0" width="0.0" height="0.0" />
     <map button="Tip" to="Left" />
       - sendEventsMode [yes|no|disabledOnExternalMouse]
       - calibrationMatrix [six float values split by space]
       - scrollFactor [float]
-   
+
     The following <libinput>...</libinput> block may not be complete for
     your requirements. Default values are device specific. Only set an option
     if you require to override the default. Valid values must be inserted.
 
   <libinput>
     <device category="default">
-      <naturalScroll></naturalScroll>
-      <leftHanded></leftHanded>
-      <pointerSpeed></pointerSpeed>
-      <accelProfile></accelProfile>
+      <!-- <naturalScroll>no</naturalScroll> -->
+      <!-- <leftHanded>no</leftHanded> -->
+      <!-- <pointerSpeed>0.0</pointerSpeed> -->
+      <!-- <accelProfile>adaptive</accelProfile> -->
       <tap>yes</tap>
-      <tapButtonMap></tapButtonMap>
-      <tapAndDrag></tapAndDrag>
-      <dragLock></dragLock>
-      <threeFingerDrag></threeFingerDrag>
-      <middleEmulation></middleEmulation>
-      <disableWhileTyping></disableWhileTyping>
-      <clickMethod></clickMethod>
-      <scrollMethod></scrollMethod>
-      <sendEventsMode></sendEventsMode>
-      <calibrationMatrix></calibrationMatrix>
+      <!-- <tapButtonMap>lrm</tapButtonMap> -->
+      <!-- <tapAndDrag>yes</tapAndDrag> -->
+      <!-- <dragLock>yes</dragLock> -->
+      <!-- <threeFingerDrag>yes</threeFingerDrag> -->
+      <!-- <middleEmulation>no</middleEmulation> -->
+      <!-- <disableWhileTyping>yes</disableWhileTyping> -->
+      <!-- <clickMethod>buttonAreas</clickMethod> -->
+      <!-- <scrollMethod>twofinger</scrollMethod> -->
+      <!-- <sendEventsMode>yes</sendEventsMode> -->
+      <!-- <calibrationMatrix>1 0 0 0 1 0</calibrationMatrix> -->
       <scrollFactor>1.0</scrollFactor>
     </device>
   </libinput>
     <height>400</height>
     <initScale>2.0</initScale>
     <increment>0.2</increment>
-    <useFilter>true</useFilter>
+    <useFilter>yes</useFilter>
   </magnifier>
 
 </labwc_config>
index c5d94d4f35affd0f2d4ebe61c8e4f7fea760ded1..84054e82450f9f206b6472f3545ccca3050a9445 100644 (file)
@@ -714,6 +714,8 @@ fill_libinput_category(xmlNode *node)
        char *key, *content;
        LAB_XML_FOR_EACH(node, child, key, content) {
                if (string_null_or_empty(content)) {
+                       wlr_log(WLR_ERROR, "Empty string is not allowed for "
+                               "<libinput><device><%s>. Ignoring.", key);
                        continue;
                }
                if (!strcmp(key, "category")) {
@@ -1076,7 +1078,8 @@ entry(xmlNode *node, char *nodename, char *content)
                return true;
 
        } else if (str_space_only(content)) {
-               /* ignore empty leaf nodes other than above */
+               wlr_log(WLR_ERROR, "Empty string is not allowed for %s. "
+                       "Ignoring.", nodename);
 
        /* handle non-empty leaf nodes */
        } else if (!strcmp(nodename, "decoration.core")) {