makekeys: Handle XF86XK_ keysyms in addition to XK_ keysyms
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
diff --git a/src/makekeys.c b/src/makekeys.c
index b563ff9..ed964e7 100644
--- a/src/makekeys.c
+++ b/src/makekeys.c
@@ -74,11 +74,42 @@ main(int argc, char *argv[])
while (fgets(buf, sizeof(buf), stdin)) {
+ int handled = 0;
+
+ /* Manage keysyms from keysymdef.h */
i = sscanf(buf, "#define XK_%127s 0x%lx", key, &info[ksnum].val);
- if (i != 2) {
+ if (i == 2) {
+ handled = 1;
+ } else {
i = sscanf(buf, "#define XK_%127s XK_%127s", key, alias);
- if (i != 2)
- continue;
+ if (i == 2) {
+ for (i = ksnum - 1; i >= 0; i--) {
+ if (strcmp(info[i].name, alias) == 0) {
+ info[ksnum].val = info[i].val;
+ handled = 1;
+ break;
+ }
+ }
+ if (i < 0) { /* Didn't find a match */
+ fprintf(stderr,
+ "can't find matching definition %s for keysym %s\n",
+ alias, key);
+ continue;
+ }
+ }
+ }
+
+ /* Manage keysyms from XF86keysym.h */
+ if (!handled)
+ i = sscanf(buf, "#define XF86XK_%127s 0x%lx", key, &info[ksnum].val);
+ if (!handled && i != 2) {
+ /* Try to handle both XF86XK and XK aliases */
+ i = sscanf(buf, "#define XF86XK_%127s XF86XK_%127s", key, alias);
+ if (i != 2) {
+ i = sscanf(buf, "#define XF86XK_%127s XK_%127s", key, alias);
+ if (i != 2)
+ continue;
+ }
for (i = ksnum - 1; i >= 0; i--) {
if (strcmp(info[i].name, alias) == 0) {
info[ksnum].val = info[i].val;
@@ -92,6 +123,7 @@ main(int argc, char *argv[])
continue;
}
}
+
if (info[ksnum].val == XK_VoidSymbol)
info[ksnum].val = 0;
if (info[ksnum].val > 0x1fffffff) {