aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/lib
diff options
context:
space:
mode:
authorDaniel Stone <daniel@fooishbar.org>2010-07-09 18:13:13 +0100
committerUlrich Sibiller <uli42@gmx.de>2016-10-19 21:40:24 +0200
commit93b55eeec022007d638c0a3b305765d44d3cd185 (patch)
treeb6d3f0c6e919a6d5fc7bcd74ba53a74b06f5bdbc /nx-X11/lib
parentb414bc2c6f389224023c1d184d8aa0d18387512c (diff)
downloadnx-libs-93b55eeec022007d638c0a3b305765d44d3cd185.tar.gz
nx-libs-93b55eeec022007d638c0a3b305765d44d3cd185.tar.bz2
nx-libs-93b55eeec022007d638c0a3b305765d44d3cd185.zip
XStringToKeysym: Cope with 0x1234cafe-style input
If we get input in the style of 0xdeadbeef, just return that exact keysym. Introduces a dependency on strtoul, which I'm told is OK on all the systems we care about. Signed-off-by: Daniel Stone <daniel@fooishbar.org> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
Diffstat (limited to 'nx-X11/lib')
-rw-r--r--nx-X11/lib/X11/StrKeysym.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/nx-X11/lib/X11/StrKeysym.c b/nx-X11/lib/X11/StrKeysym.c
index a05e755e9..21dec924b 100644
--- a/nx-X11/lib/X11/StrKeysym.c
+++ b/nx-X11/lib/X11/StrKeysym.c
@@ -27,6 +27,7 @@ in this Software without prior written authorization from The Open Group.
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
+#include <limits.h>
#include "Xlibint.h"
#include <nx-X11/Xresource.h>
#include <nx-X11/keysymdef.h>
@@ -153,6 +154,15 @@ XStringToKeysym(_Xconst char *s)
return val | 0x01000000;
}
+ if (strlen(s) > 2 && s[0] == '0' && s[1] == 'x') {
+ char *tmp = NULL;
+ val = strtoul(s, &tmp, 16);
+ if (val == ULONG_MAX || (tmp && *tmp != '\0'))
+ return NoSymbol;
+ else
+ return val;
+ }
+
/* Stupid inconsistency between the headers and XKeysymDB: the former has
* no separating underscore, while some XF86* syms in the latter did.
* As a last ditch effort, try without. */