diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2010-10-05 19:51:00 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2010-10-05 19:51:00 +0000 |
commit | a6fc6740cffa7e274f9a86ce485983548cef24ef (patch) | |
tree | d5f6d95d9d3a7781bf423533ccc27977d833fc91 /lib/libX11/src/StrKeysym.c | |
parent | 886d6f45644e0f447292393ce4d0cad38cb6dfb8 (diff) |
Update to libX11 1.3.6.
Tested by ajacoutot@, jasper@ and krw@.
Diffstat (limited to 'lib/libX11/src/StrKeysym.c')
-rw-r--r-- | lib/libX11/src/StrKeysym.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/libX11/src/StrKeysym.c b/lib/libX11/src/StrKeysym.c index fb507458f..4394e0cd2 100644 --- a/lib/libX11/src/StrKeysym.c +++ b/lib/libX11/src/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 <X11/Xresource.h> #include <X11/keysymdef.h> @@ -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; } |