summaryrefslogtreecommitdiffstatshomepage
path: root/xkbcat.c
diff options
context:
space:
mode:
authorGravatar Antti K2014-08-02 18:13:53 +0200
committerGravatar Antti K2014-08-02 18:15:01 +0200
commitca9105f634badf6071aa6522c23e9219abeed2a8 (patch)
treef28ef4e8e53fe84a92952ae947745dd983841d25 /xkbcat.c
parente1e84630314fe01e96e9846078e7557ed2277b83 (diff)
downloadxkbcat-ca9105f634badf6071aa6522c23e9219abeed2a8.tar.gz
xkbcat-ca9105f634badf6071aa6522c23e9219abeed2a8.zip
Document keyState function
Yeah, that did look a bit arcane.
Diffstat (limited to 'xkbcat.c')
-rw-r--r--xkbcat.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/xkbcat.c b/xkbcat.c
index 7a39a99..bfa7eab 100644
--- a/xkbcat.c
+++ b/xkbcat.c
@@ -14,8 +14,12 @@ const bool DEFAULT_PRINT_UP = false;
const bool DEFAULT_PRINT_TIME = false;
typedef char KbBuffer[32];
+
static inline bool keyState(KbBuffer b, int key) {
+ // Fetch the `key`-th bit from the buffer.
return b[key/8] & (1<<(key%8));
+ // This is because XQueryKeymap just writes a bit per key into the buffer.
+ // Assuming 8-bit chars here, of course.
}
int printUsage() {