diff options
| author | 2014-07-29 18:31:41 +0200 | |
|---|---|---|
| committer | 2014-07-30 01:11:08 +0200 | |
| commit | 23825cc80443d321f116cc036afd031d6bf3f323 (patch) | |
| tree | f29b26032a15fa6d7c5c60e203e14afa436214e1 /xkbcat.c | |
| parent | 471861c4d501df6d941bd7431918cf181d506e15 (diff) | |
| download | xkbcat-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`.
Diffstat (limited to 'xkbcat.c')
| -rw-r--r-- | xkbcat.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -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 ""; |
