From cd6c9e4d8c6a49eb91091c00b55e0f879c9220bf Mon Sep 17 00:00:00 2001
From: Přemysl Janouch
Date: Wed, 12 Sep 2018 13:38:33 +0200
Subject: ht: add generated X11 keysym maps
Now we can make sense of keysyms and translate them to text.
---
ht/gen-keysyms.sh | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
create mode 100755 ht/gen-keysyms.sh
(limited to 'ht/gen-keysyms.sh')
diff --git a/ht/gen-keysyms.sh b/ht/gen-keysyms.sh
new file mode 100755
index 0000000..064dec4
--- /dev/null
+++ b/ht/gen-keysyms.sh
@@ -0,0 +1,49 @@
+#!/bin/sh
+gofmt < $hex, ident => $ident, comment => $comment };
+
+ $nametokeysym{$name} = $ident;
+
+ # All but the first name listed should be considered deprecated.
+ $keysymtoname{$ident} = $name unless exists $seen{$hex};
+ $seen{$hex}++;
+
+ END {
+ print "const (";
+ print "$_->{ident} = 0x$_->{hex} // $_->{comment}" for @a;
+ print ")";
+
+ # Very large tables, should be an on-demand package :(
+
+ print "// KeysymToName maps X11 keysym constants to their names";
+ print "var KeysymToName = map[xproto.Keysym]string{";
+ print "$_: \"$keysymtoname{$_}\"," for sort keys %keysymtoname;
+ print "}";
+
+ print "// NameToKeysym maps X11 keysym names to their constants";
+ print "var NameToKeysym = map[string]xproto.Keysym{";
+ print "\"$_\": $nametokeysym{$_}," for sort keys %nametokeysym;
+ print "}";
+ }
+')
+EOF
--
cgit v1.2.3-54-g00ecf