[PATCH evdev 2/2] Drop special XKB option handling

Peter Hutterer peter.hutterer at who-t.net
Sun Jan 6 20:38:15 PST 2013


This isn't actually needed at all.

xf86nameCompare() will skip over underscores and is case-independent. So
xf86SetStrOption("foo_bar") will return an Option "FooBar" and vice versa.

The server won't return a zero-length string either, it'll return
NULL and spit a warning to the log.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/evdev.c | 34 +++++-----------------------------
 1 file changed, 5 insertions(+), 29 deletions(-)

diff --git a/src/evdev.c b/src/evdev.c
index 9337552..af7dcff 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -279,22 +279,6 @@ EvdevRemoveDevice(InputInfoPtr pInfo)
     }
 }
 
-
-static void
-SetXkbOption(InputInfoPtr pInfo, const char *name, char **option)
-{
-    char *s;
-
-    if ((s = xf86SetStrOption(pInfo->options, name, NULL))) {
-        if (!s[0]) {
-            free(s);
-            *option = NULL;
-        } else {
-            *option = s;
-        }
-    }
-}
-
 static BOOL
 EvdevDeviceIsVirtual(const char* devicenode)
 {
@@ -1179,19 +1163,11 @@ EvdevAddKeyClass(DeviceIntPtr device)
 
     /* sorry, no rules change allowed for you */
     xf86ReplaceStrOption(pInfo->options, "xkb_rules", "evdev");
-    SetXkbOption(pInfo, "xkb_rules", &rmlvo.rules);
-    SetXkbOption(pInfo, "xkb_model", &rmlvo.model);
-    if (!rmlvo.model)
-        SetXkbOption(pInfo, "XkbModel", &rmlvo.model);
-    SetXkbOption(pInfo, "xkb_layout", &rmlvo.layout);
-    if (!rmlvo.layout)
-        SetXkbOption(pInfo, "XkbLayout", &rmlvo.layout);
-    SetXkbOption(pInfo, "xkb_variant", &rmlvo.variant);
-    if (!rmlvo.variant)
-        SetXkbOption(pInfo, "XkbVariant", &rmlvo.variant);
-    SetXkbOption(pInfo, "xkb_options", &rmlvo.options);
-    if (!rmlvo.options)
-        SetXkbOption(pInfo, "XkbOptions", &rmlvo.options);
+    rmlvo.rules = xf86SetStrOption(pInfo->options, "xkb_rules", NULL);
+    rmlvo.model = xf86SetStrOption(pInfo->options, "xkb_model", NULL);
+    rmlvo.layout = xf86SetStrOption(pInfo->options, "xkb_layout", NULL);
+    rmlvo.variant = xf86SetStrOption(pInfo->options, "xkb_variant", NULL);
+    rmlvo.options = xf86SetStrOption(pInfo->options, "xkb_options", NULL);
 
     if (!InitKeyboardDeviceStruct(device, &rmlvo, NULL, EvdevKbdCtrl))
         rc = !Success;
-- 
1.8.1



More information about the xorg-devel mailing list