diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2020-07-07 14:01:49 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2020-07-07 14:16:33 +0200 |
commit | 98e239ffbf1e541aabafdda5bdf86662c4183f94 (patch) | |
tree | 51b01fe2315b36e180ed99df92617dfb46c01f0f | |
parent | 699e78a3f73184ba1adf38c048caff87c16fc495 (diff) | |
download | at-spi2-core-98e239ffbf1e541aabafdda5bdf86662c4183f94.tar.gz |
keysymtab: Add (re)generation script
It does not produce exactly the same content yet, as the
left/rightanglebracket unicode equivalent was not defined in xterm as
what Xorg currently says.
-rw-r--r-- | registryd/ucs2keysym.c | 7 | ||||
-rwxr-xr-x | registryd/ucs2keysym.sh | 38 |
2 files changed, 43 insertions, 2 deletions
diff --git a/registryd/ucs2keysym.c b/registryd/ucs2keysym.c index a077ce03..09f5fd3c 100644 --- a/registryd/ucs2keysym.c +++ b/registryd/ucs2keysym.c @@ -34,6 +34,9 @@ #include <X11/X.h> #include "deviceeventcontroller.h" /* for prototype */ +/* DO NOT UPATE BY HAND! + * This table can be regenerated from Xorg's keysymdef.h with the ucs2keysym.sh + * script. */ struct codepair { unsigned short keysym; unsigned short ucs; @@ -603,8 +606,8 @@ struct codepair { { 0x0afa, 0x2315 }, /* telephonerecorder ⌕ TELEPHONE RECORDER */ { 0x08a4, 0x2320 }, /* topintegral ⌠ TOP HALF INTEGRAL */ { 0x08a5, 0x2321 }, /* botintegral ⌡ BOTTOM HALF INTEGRAL */ - { 0x0abc, 0x2329 }, /* leftanglebracket 〈 LEFT-POINTING ANGLE BRACKET */ - { 0x0abe, 0x232a }, /* rightanglebracket 〉 RIGHT-POINTING ANGLE BRACKET */ + { 0x0abc, 0x2329 }, /* leftanglebracket 〈 LEFT-POINTING ANGLE BRACKET, not U+27E8 per xterm source */ + { 0x0abe, 0x232a }, /* rightanglebracket 〉 RIGHT-POINTING ANGLE BRACKET, not U+27E9 per xterm source */ { 0x0bcc, 0x2395 }, /* quad ⎕ APL FUNCTIONAL SYMBOL QUAD */ { 0x08ab, 0x239b }, /* topleftparens ⎛ LEFT PARENTHESIS UPPER HOOK */ { 0x08ac, 0x239d }, /* botleftparens ⎝ LEFT PARENTHESIS LOWER HOOK */ diff --git a/registryd/ucs2keysym.sh b/registryd/ucs2keysym.sh new file mode 100755 index 00000000..ff37f53b --- /dev/null +++ b/registryd/ucs2keysym.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +if [ "$#" = 0 ] +then + echo "Usage: $0 /path/to/keysymdef.h" + exit 1 +fi + +# We are only interested in +# - keysyms which have well-defined unicode equivalent +# - and are not just trivial unicode keysyms +# - non-latin1 keysyms +# - not the lamda aliases +# and we tinker with the alias parentheses to make sorting easier + +grep '^#define' "$1" | \ + grep -i "U+" | \ + grep -vi "0x100[0-9a-f][0-9a-f][0-9a-f][0-9a-f]" | \ + grep -vi " 0x00[0-9a-f][0-9a-f] " | \ + grep -vi "_lamda " | \ + sed -e 's/\/\*(/& /' | \ + sed -e 's/)\*\// &/' | \ + sort -k 5 | \ + perl -CS -e ' +my $last = 0; +while (<>) { + chomp; + if ( /^\#define XK_([a-zA-Z_0-9]+)(\s*) 0x([0-9a-f]+)\s*\/\*(\(?) U\+([0-9A-F]{4,6}) (.*) \)?\*\/\s*$/ ) { + my ( $xk, $space, $keysym, $paren, $unicode, $unistr ) = ( $1, $2, $3, $4, $5, $6); + $unicode = hex("0x".$unicode); + + print "\n" if (int($unicode / 256) != int($last / 256)); + $last = $unicode; + + printf " { 0x$keysym, 0x%04x }, /* $space$xk %lc $unistr */\n", $unicode, $unicode; + } +} + ' |