From 23825cc80443d321f116cc036afd031d6bf3f323 Mon Sep 17 00:00:00 2001 From: Antti K Date: Tue, 29 Jul 2014 18:31:41 +0200 Subject: 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`. --- xkbcat.c | 7 +++---- 1 file 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 ""; -- cgit v1.3-2-g0d8e