Commit 93b55eee authored by Daniel Stone's avatar Daniel Stone Committed by Ulrich Sibiller

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: 's avatarDaniel Stone <daniel@fooishbar.org> Backported-to-NX-by: 's avatarUlrich Sibiller <uli42@gmx.de>
parent b414bc2c
...@@ -27,6 +27,7 @@ in this Software without prior written authorization from The Open Group. ...@@ -27,6 +27,7 @@ in this Software without prior written authorization from The Open Group.
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> #include <config.h>
#endif #endif
#include <limits.h>
#include "Xlibint.h" #include "Xlibint.h"
#include <nx-X11/Xresource.h> #include <nx-X11/Xresource.h>
#include <nx-X11/keysymdef.h> #include <nx-X11/keysymdef.h>
...@@ -153,6 +154,15 @@ XStringToKeysym(_Xconst char *s) ...@@ -153,6 +154,15 @@ XStringToKeysym(_Xconst char *s)
return val | 0x01000000; 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 /* Stupid inconsistency between the headers and XKeysymDB: the former has
* no separating underscore, while some XF86* syms in the latter did. * no separating underscore, while some XF86* syms in the latter did.
* As a last ditch effort, try without. */ * As a last ditch effort, try without. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment