summaryrefslogtreecommitdiff
path: root/parseutils.c
diff options
context:
space:
mode:
authorDaniel Stone <daniel@fooishbar.org>2010-07-09 19:34:29 +0100
committerDaniel Stone <daniel@fooishbar.org>2010-07-09 19:34:29 +0100
commita281386fa887e6bf4110840779aed46dd0ac89b6 (patch)
tree1a2ff173806fc86f0bc91a79475db064f1fdacb2 /parseutils.c
parent0b04ecbb7a6afb223c91d3b15baab0bc48542281 (diff)
downloadxorg-app-xkbcomp-a281386fa887e6bf4110840779aed46dd0ac89b6.tar.gz
Fix parsing of 0x1a2b3c4d-style symbols
Raw keysyms were not getting parsed correctly, due to forgetting to add the code to libX11, forgetting to add the backwards-compat code for old libX11s, and then stuffing the lexing up anyway. Yeesh. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Diffstat (limited to 'parseutils.c')
-rw-r--r--parseutils.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/parseutils.c b/parseutils.c
index d59e3fb..3242965 100644
--- a/parseutils.c
+++ b/parseutils.c
@@ -30,6 +30,10 @@
#include <X11/keysym.h>
#include <X11/extensions/XKBgeom.h>
#include <X11/Xalloca.h>
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+#include <stdlib.h>
XkbFile *rtrnValue;
@@ -623,6 +627,7 @@ int
LookupKeysym(char *str, KeySym * sym_rtrn)
{
KeySym sym;
+ char *tmp;
if ((!str) || (uStrCaseCmp(str, "any") == 0)
|| (uStrCaseCmp(str, "nosymbol") == 0))
@@ -642,6 +647,13 @@ LookupKeysym(char *str, KeySym * sym_rtrn)
*sym_rtrn = sym;
return 1;
}
+ if (strlen(str) > 2 && str[0] == '0' && str[1] == 'x') {
+ sym = strtoul(str, &tmp, 16);
+ if (sym != ULONG_MAX && (!tmp || *tmp == '\0')) {
+ *sym_rtrn = sym;
+ return 1;
+ }
+ }
return 0;
}