summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2008-08-01 14:24:54 +0930
committerPeter Hutterer <peter.hutterer@who-t.net>2008-08-06 10:34:35 +0930
commit7d508f783c715d633df4f7f924523bd4e1724e08 (patch)
tree306087ec9041e481eb3577f36389c6e92b00cc28
parent2f6b270e48ec7b9eb9ff8f98281308f50c081b63 (diff)
config: support type strlist for XkbOptions property.
For backwards compatibility with server 1.4. (cherry picked from commit 92c51b183c2ff06361dad7f918daed6577ba4935)
-rw-r--r--config/hal.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/config/hal.c b/config/hal.c
index e3cbcf99a..c60e23a0f 100644
--- a/config/hal.c
+++ b/config/hal.c
@@ -132,9 +132,6 @@ get_prop_string(LibHalContext *hal_ctx, const char *udi, const char *name)
return ret;
}
-/* this function is no longer used... keep it here in case its needed in
- * the future. */
-#if 0
static char *
get_prop_string_array(LibHalContext *hal_ctx, const char *udi, const char *prop)
{
@@ -168,7 +165,6 @@ get_prop_string_array(LibHalContext *hal_ctx, const char *udi, const char *prop)
return ret;
}
-#endif
static void
device_added(LibHalContext *hal_ctx, const char *udi)
@@ -250,12 +246,12 @@ device_added(LibHalContext *hal_ctx, const char *udi)
/* normal options first (input.x11_options.<propname>) */
if (!strncasecmp(psi_key, LIBHAL_PROP_KEY, sizeof(LIBHAL_PROP_KEY)-1)){
+ char* tmp;
/* only support strings for all values */
tmp_val = get_prop_string(hal_ctx, udi, psi_key);
if (tmp_val){
- char* tmp;
/* xkb needs special handling. HAL specs include
* input.xkb.xyz options, but the x11-input.fdi specifies
@@ -298,14 +294,25 @@ device_added(LibHalContext *hal_ctx, const char *udi)
add_option(&options, psi_key + sizeof(LIBHAL_PROP_KEY)-1, tmp_val);
xfree(tmp_val);
}
+ } else
+ {
+ /* server 1.4 had xkb_options as strlist. */
+ if ((tmp = strcasestr(psi_key, "xkb")) &&
+ (!strcasecmp(&tmp[3], "options")) &&
+ (tmp_val = get_prop_string_array(hal_ctx, udi, psi_key)))
+ {
+ if (xkb_opts.options)
+ xfree(xkb_opts.options);
+ xkb_opts.options = strdup(tmp_val);
+ }
}
} else if (!strncasecmp(psi_key, LIBHAL_XKB_PROP_KEY, sizeof(LIBHAL_XKB_PROP_KEY)-1)){
+ char* tmp;
/* only support strings for all values */
tmp_val = get_prop_string(hal_ctx, udi, psi_key);
if (tmp_val){
- char* tmp;
tmp = &psi_key[sizeof(LIBHAL_XKB_PROP_KEY) - 1];
@@ -331,6 +338,16 @@ device_added(LibHalContext *hal_ctx, const char *udi)
xkb_opts.options = strdup(tmp_val);
}
xfree(tmp_val);
+ } else
+ {
+ /* server 1.4 had xkb options as strlist */
+ tmp_val = get_prop_string_array(hal_ctx, udi, psi_key);
+ if (tmp_val)
+ {
+ tmp = &psi_key[sizeof(LIBHAL_XKB_PROP_KEY) - 1];
+ if (!strcasecmp(tmp, ".options") && (!xkb_opts.options))
+ xkb_opts.options = strdup(tmp_val);
+ }
}
}
}