[PATCH libX11 2/4] XStringToKeysym: Special case for XF86 keysyms

Daniel Stone daniel at fooishbar.org
Thu Jul 8 07:00:33 PDT 2010


Some XFree86 keysyms were in XKeysymDB as XF86_foo, despite really being
XF86foo.  So, if we get to the bottom of XStringToKeysym and haven't
found our XF86_foo, try it again as XF86foo.

Signed-off-by: Daniel Stone <daniel at fooishbar.org>
---
 src/StrKeysym.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/src/StrKeysym.c b/src/StrKeysym.c
index fb50745..f502de1 100644
--- a/src/StrKeysym.c
+++ b/src/StrKeysym.c
@@ -152,5 +152,18 @@ XStringToKeysym(_Xconst char *s)
 	    return val;
         return val | 0x01000000;
     }
+
+    /* 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);
+        memmove(&tmp[4], &tmp[5], strlen(s) - 5 + 1);
+        ret = XStringToKeysym(tmp);
+        free(tmp);
+        return ret;
+    }
+
     return NoSymbol;
 }
-- 
1.7.1



More information about the xorg-devel mailing list