summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2009-09-16 07:01:11 +0000
committered <ed@FreeBSD.org>2009-09-16 07:01:11 +0000
commitabdb857fc1ed9cc0d76df38d6c54c19054ac1d74 (patch)
tree2ebe3f9d6850f8501fe6724c9447a673289545b4
parent510264aac8f582a05fba8f9397b516b0b8135b06 (diff)
downloadFreeBSD-src-abdb857fc1ed9cc0d76df38d6c54c19054ac1d74.zip
FreeBSD-src-abdb857fc1ed9cc0d76df38d6c54c19054ac1d74.tar.gz
Extend the keyboard character size to 24 bits.
Because we use an int to store keyboard chacacters and their flags, we can easily store the flags in the top byte instead of the second byte. This means it's a lot easier to make Unicode work. The only change that still needs to be made, is that keyent_t's map is extended to u_int. Obtained from: //depot/projects/newcons/sys/sys/kbio.h
-rw-r--r--sys/sys/kbio.h28
1 files changed, 17 insertions, 11 deletions
diff --git a/sys/sys/kbio.h b/sys/sys/kbio.h
index 00bcacf..6f82c6d 100644
--- a/sys/sys/kbio.h
+++ b/sys/sys/kbio.h
@@ -229,16 +229,22 @@ typedef struct fkeyarg fkeyarg_t;
/* flags set to the return value in the KD_XLATE mode */
-#define NOKEY 0x100 /* no key pressed marker */
-#define FKEY 0x200 /* function key marker */
-#define MKEY 0x400 /* meta key marker (prepend ESC)*/
-#define BKEY 0x800 /* backtab (ESC [ Z) */
-
-#define SPCLKEY 0x8000 /* special key */
-#define RELKEY 0x4000 /* key released */
-#define ERRKEY 0x2000 /* error */
-
-#define KEYCHAR(c) ((c) & 0x00ff)
-#define KEYFLAGS(c) ((c) & ~0x00ff)
+#define NOKEY 0x01000000 /* no key pressed marker */
+#define FKEY 0x02000000 /* function key marker */
+#define MKEY 0x04000000 /* meta key marker (prepend ESC)*/
+#define BKEY 0x08000000 /* backtab (ESC [ Z) */
+
+#define SPCLKEY 0x80000000 /* special key */
+#define RELKEY 0x40000000 /* key released */
+#define ERRKEY 0x20000000 /* error */
+
+/*
+ * The top byte is used to store the flags. This means there are 24
+ * bits left to store the actual character. Because UTF-8 can encode
+ * 2^21 different characters, this is good enough to get Unicode
+ * working.
+ */
+#define KEYCHAR(c) ((c) & 0x00ffffff)
+#define KEYFLAGS(c) ((c) & ~0x00ffffff)
#endif /* !_SYS_KBIO_H_ */
OpenPOWER on IntegriCloud