summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorGravatar Antti K2014-07-29 18:31:41 +0200
committerGravatar Antti K2014-07-30 01:11:08 +0200
commit23825cc80443d321f116cc036afd031d6bf3f323 (patch)
treef29b26032a15fa6d7c5c60e203e14afa436214e1
parent471861c4d501df6d941bd7431918cf181d506e15 (diff)
downloadxkbcat-23825cc80443d321f116cc036afd031d6bf3f323.tar.gz
xkbcat-23825cc80443d321f116cc036afd031d6bf3f323.zip
Rename stringification function
It's not just converting a keycode, but also the key's down-state, so this is a better name. Also converted down-state arg to `bool`.
-rw-r--r--xkbcat.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/xkbcat.c b/xkbcat.c
index 17b4ecc..6fa7cd6 100644
--- a/xkbcat.c
+++ b/xkbcat.c
@@ -32,7 +32,7 @@ const int KEYSYM_STRLEN = 64;
Display *disp;
int printKeyUps = false;
-char *KeyCodeToStr(int code, int down);
+char *keyPressToString(int code, bool down);
int usage() {
printf("\
@@ -86,8 +86,7 @@ int main(int argc, char *argv[]) {
XQueryKeymap(disp, keys);
for (int i = 0; i < 32*8; i++) {
if (BIT(keys, i) != BIT(saved, i)) {
- register char *str;
- str = (char *)KeyCodeToStr(i, BIT(keys, i));
+ register char *str = keyPressToString(i, BIT(keys, i));
if (BIT(keys, i) != 0 || printKeyUps) printf("%s\n",str);
fflush(stdout); /* in case user is writing to a pipe */
}
@@ -109,7 +108,7 @@ int main(int argc, char *argv[]) {
Print out the string.
*/
-char *KeyCodeToStr(int code, int down) {
+char *keyPressToString(int code, bool down) {
static char *str, buf[KEYSYM_STRLEN + 1];
KeySym keysym = XkbKeycodeToKeysym(disp, code, 0, 0);
if (NoSymbol == keysym) return "";