aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/lib/X11/StrKeysym.c
diff options
context:
space:
mode:
Diffstat (limited to 'nx-X11/lib/X11/StrKeysym.c')
-rw-r--r--nx-X11/lib/X11/StrKeysym.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/nx-X11/lib/X11/StrKeysym.c b/nx-X11/lib/X11/StrKeysym.c
index 9bdc80d32..125aceca3 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>
@@ -93,7 +94,7 @@ XStringToKeysym(_Xconst char *s)
{
entry = &_XkeyTable[idx];
if ((entry[0] == sig1) && (entry[1] == sig2) &&
- !strcmp(s, (char *)entry + 6))
+ !strcmp(s, (const char *)entry + 6))
{
val = (entry[2] << 24) | (entry[3] << 16) |
(entry[4] << 8) | entry[5];
@@ -152,5 +153,29 @@ XStringToKeysym(_Xconst char *s)
return val;
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. */
+ if (strncmp(s, "XF86_", 5) == 0) {
+ KeySym ret;
+ char *tmp = strdup(s);
+ if (!tmp)
+ return NoSymbol;
+ memmove(&tmp[4], &tmp[5], strlen(s) - 5 + 1);
+ ret = XStringToKeysym(tmp);
+ free(tmp);
+ return ret;
+ }
+
return NoSymbol;
}