From 4875a15ca61358a1c95b156b2279fce092451278 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 19 Jan 2022 00:45:43 +0100 Subject: Update libNX_X11 to upstream's libX11-1.7.3.1-10-gd60ede78 --- nx-X11/lib/src/util/makekeys.c | 35 +++++++++++++++++++++++++++-------- nx-X11/lib/src/util/mkks.sh | 5 +++-- 2 files changed, 30 insertions(+), 10 deletions(-) (limited to 'nx-X11/lib/src/util') 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 -#include -#include -#include +#ifdef HAVE_CONFIG_H +#include +#endif + #include #include +#include +#include +#include -#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); \ -}' "$@" +}' + -- cgit v1.2.3