forked from pool/xorg-x11-server
6294ad6cbb
OBS-URL: https://build.opensuse.org/package/show/X11:XOrg/xorg-x11-server?expand=0&rev=059278921dffcec888453e1db8ed4b3c
92 lines
2.9 KiB
Diff
92 lines
2.9 KiB
Diff
--- hw/xfree86/parser/InputClass.c
|
|
+++ hw/xfree86/parser/InputClass.c
|
|
@@ -61,6 +61,47 @@
|
|
|
|
#define TOKEN_SEP "|"
|
|
|
|
+/*
|
|
+ * Tokenize a string into a NULL terminated array of strings. Always returns
|
|
+ * an allocated array unless an error occurs.
|
|
+ */
|
|
+char**
|
|
+m_xstrtokenize(const char *str, const char *separators)
|
|
+{
|
|
+ char **list, **nlist;
|
|
+ char *tok, *tmp;
|
|
+ unsigned num = 0, n;
|
|
+
|
|
+ if (!str)
|
|
+ return NULL;
|
|
+ list = calloc(1, sizeof(*list));
|
|
+ if (!list)
|
|
+ return NULL;
|
|
+ tmp = strdup(str);
|
|
+ if (!tmp)
|
|
+ goto error;
|
|
+ for (tok = strtok(tmp, separators); tok; tok = strtok(NULL, separators)) {
|
|
+ nlist = realloc(list, (num + 2) * sizeof(*list));
|
|
+ if (!nlist)
|
|
+ goto error;
|
|
+ list = nlist;
|
|
+ list[num] = strdup(tok);
|
|
+ if (!list[num])
|
|
+ goto error;
|
|
+ list[++num] = NULL;
|
|
+ }
|
|
+ free(tmp);
|
|
+ return list;
|
|
+
|
|
+error:
|
|
+ free(tmp);
|
|
+ for (n = 0; n < num; n++)
|
|
+ free(list[n]);
|
|
+ free(list);
|
|
+ return NULL;
|
|
+}
|
|
+
|
|
+
|
|
XF86ConfInputClassPtr
|
|
xf86parseInputClassSection(void)
|
|
{
|
|
@@ -96,22 +137,22 @@
|
|
case MATCH_PRODUCT:
|
|
if (xf86getSubToken(&(ptr->comment)) != STRING)
|
|
Error(QUOTE_MSG, "MatchProduct");
|
|
- ptr->match_product = xstrtokenize(val.str, TOKEN_SEP);
|
|
+ ptr->match_product = m_xstrtokenize(val.str, TOKEN_SEP);
|
|
break;
|
|
case MATCH_VENDOR:
|
|
if (xf86getSubToken(&(ptr->comment)) != STRING)
|
|
Error(QUOTE_MSG, "MatchVendor");
|
|
- ptr->match_vendor = xstrtokenize(val.str, TOKEN_SEP);
|
|
+ ptr->match_vendor = m_xstrtokenize(val.str, TOKEN_SEP);
|
|
break;
|
|
case MATCH_DEVICE_PATH:
|
|
if (xf86getSubToken(&(ptr->comment)) != STRING)
|
|
Error(QUOTE_MSG, "MatchDevicePath");
|
|
- ptr->match_device = xstrtokenize(val.str, TOKEN_SEP);
|
|
+ ptr->match_device = m_xstrtokenize(val.str, TOKEN_SEP);
|
|
break;
|
|
case MATCH_TAG:
|
|
if (xf86getSubToken(&(ptr->comment)) != STRING)
|
|
Error(QUOTE_MSG, "MatchTag");
|
|
- ptr->match_tag = xstrtokenize(val.str, TOKEN_SEP);
|
|
+ ptr->match_tag = m_xstrtokenize(val.str, TOKEN_SEP);
|
|
break;
|
|
case MATCH_IS_KEYBOARD:
|
|
if (xf86getSubToken(&(ptr->comment)) != STRING)
|
|
--- hw/xfree86/parser/Layout.c
|
|
+++ hw/xfree86/parser/Layout.c
|
|
@@ -449,7 +449,10 @@
|
|
/* add all AutoServerLayout devices to the server layout */
|
|
while (input)
|
|
{
|
|
- if (xf86CheckBoolOption(input->inp_option_lst, "AutoServerLayout", FALSE))
|
|
+ Bool asl_value = FALSE;
|
|
+ char *s = xf86findOptionValue(input->inp_option_lst ,"AutoServerLayout");
|
|
+ Bool asl_found = xf86getBoolValue(&asl_value, s);
|
|
+ if (asl_found == TRUE && asl_value == TRUE)
|
|
{
|
|
XF86ConfInputrefPtr iref = layout->lay_input_lst;
|
|
|