diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2023-04-27 14:10:57 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2023-04-27 14:10:57 +0200 |
commit | 91d9218c0cc659f40918af6ac6c035c6c48d2c6d (patch) | |
tree | 79054df1730d4723658b02cec311bc8ba7655662 /nx-X11/lib/src/util | |
parent | a502149a844736dcc7f7dedd7c63229c74a448ee (diff) | |
parent | 4875a15ca61358a1c95b156b2279fce092451278 (diff) | |
download | nx-libs-91d9218c0cc659f40918af6ac6c035c6c48d2c6d.tar.gz nx-libs-91d9218c0cc659f40918af6ac6c035c6c48d2c6d.tar.bz2 nx-libs-91d9218c0cc659f40918af6ac6c035c6c48d2c6d.zip |
Merge branch 'uli42-pr/update_libX11_2022' into 3.6.x
Attributes GH PR #1037: https://github.com/ArcticaProject/nx-libs/pull/1037
Diffstat (limited to 'nx-X11/lib/src/util')
-rw-r--r-- | nx-X11/lib/src/util/makekeys.c | 35 | ||||
-rw-r--r-- | nx-X11/lib/src/util/mkks.sh | 5 |
2 files changed, 30 insertions, 10 deletions
diff --git a/nx-X11/lib/src/util/makekeys.c b/nx-X11/lib/src/util/makekeys.c index 897b882dc..4896cc539 100644 --- a/nx-X11/lib/src/util/makekeys.c +++ b/nx-X11/lib/src/util/makekeys.c @@ -28,17 +28,24 @@ from The Open Group. /* Constructs hash tables for XStringToKeysym and XKeysymToString. */ -#include <nx-X11/X.h> -#include <nx-X11/Xos.h> -#include <nx-X11/Xresource.h> -#include <nx-X11/keysymdef.h> +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + #include <stdio.h> #include <stdlib.h> +#include <string.h> +#include <stdint.h> +#include <inttypes.h> -#include "../Xresinternal.h" +typedef uint32_t Signature; #define KTNUM 4000 +#define XK_VoidSymbol 0xffffff /* Void symbol */ + +typedef unsigned long KeySym; + static struct info { char *name; KeySym val; @@ -61,22 +68,34 @@ parse_line(const char *buf, char *key, KeySym *val, char *prefix) char *tmp, *tmpa; /* See if we can catch a straight XK_foo 0x1234-style definition first; - * the trickery around tmp is to account for prefices. */ + * the trickery around tmp is to account for prefixes. */ i = sscanf(buf, "#define %127s 0x%lx", key, val); if (i == 2 && (tmp = strstr(key, "XK_"))) { - memcpy(prefix, key, tmp - key); + memcpy(prefix, key, (size_t)(tmp - key)); prefix[tmp - key] = '\0'; tmp += 3; memmove(key, tmp, strlen(tmp) + 1); return 1; } + /* See if we can parse one of the _EVDEVK symbols */ + i = sscanf(buf, "#define %127s _EVDEVK(0x%lx)", key, val); + if (i == 2 && (tmp = strstr(key, "XK_"))) { + memcpy(prefix, key, (size_t)(tmp - key)); + prefix[tmp - key] = '\0'; + tmp += 3; + memmove(key, tmp, strlen(tmp) + 1); + + *val += 0x10081000; + return 1; + } + /* Now try to catch alias (XK_foo XK_bar) definitions, and resolve them * immediately: if the target is in the form XF86XK_foo, we need to * canonicalise this to XF86foo before we do the lookup. */ i = sscanf(buf, "#define %127s %127s", key, alias); if (i == 2 && (tmp = strstr(key, "XK_")) && (tmpa = strstr(alias, "XK_"))) { - memcpy(prefix, key, tmp - key); + memcpy(prefix, key, (size_t)(tmp - key)); prefix[tmp - key] = '\0'; tmp += 3; memmove(key, tmp, strlen(tmp) + 1); diff --git a/nx-X11/lib/src/util/mkks.sh b/nx-X11/lib/src/util/mkks.sh index 7af0e51ab..90f604922 100644 --- a/nx-X11/lib/src/util/mkks.sh +++ b/nx-X11/lib/src/util/mkks.sh @@ -1,10 +1,11 @@ #!/bin/sh -awk 'BEGIN { \ +cat "$@" | awk 'BEGIN { \ printf "/*\n * This file is generated from %s. Do not edit.\n */\n", \ "$(INCLUDESRC)/keysymdef.h";\ } \ /^#define/ { \ len = length($2)-3; \ printf("{ \"%s\", %s },\n", substr($2,4,len), $3); \ -}' "$@" +}' + |