wmii

git clone git://oldgit.suckless.org/wmii/
Log | Files | Refs | README | LICENSE

commit 3215520af376f89458472f28b1bfe514c1aad7f1
parent 0da586601845d7719d5429a557531e52db6c054b
Author: Anselm R. Garbe <garbeam@wmii.de>
Date:   Wed,  1 Feb 2006 22:22:55 +0200

C -> Control, M1 -> Mod1|Alt, M2 -> Mod2, ..., M5 -> Mod5, S -> Shift now


Diffstat:
liblitz/blitz.h | 1-
liblitz/kb.c | 37+++++++------------------------------
2 files changed, 7 insertions(+), 31 deletions(-)

diff --git a/liblitz/blitz.h b/liblitz/blitz.h @@ -55,7 +55,6 @@ char *blitz_buttontostr(unsigned int button); unsigned int blitz_strtobutton(char *val); /* kb.c */ -char *blitz_modtostr(unsigned long mod); unsigned long blitz_strtomod(char *val); /* util.c */ diff --git a/liblitz/kb.c b/liblitz/kb.c @@ -7,45 +7,22 @@ #include "blitz.h" -/* free the result manually! */ -char *blitz_modtostr(unsigned long mod) -{ - char result[60]; - result[0] = 0; - - if (mod & ShiftMask) - cext_strlcat(result, "S-", sizeof(result)); - if (mod & ControlMask) - cext_strlcat(result, "C-", sizeof(result)); - if (mod & Mod1Mask) - cext_strlcat(result, "M1-", sizeof(result)); - if (mod & Mod2Mask) - cext_strlcat(result, "M2-", sizeof(result)); - if (mod & Mod3Mask) - cext_strlcat(result, "M3-", sizeof(result)); - if (mod & Mod4Mask) - cext_strlcat(result, "M4-", sizeof(result)); - if (mod & Mod5Mask) - cext_strlcat(result, "M5-", sizeof(result)); - return cext_estrdup(result); -} - unsigned long blitz_strtomod(char *val) { unsigned long mod = 0; - if (strstr(val, "S-")) + if (strstr(val, "Shift")) mod |= ShiftMask; - if (strstr(val, "C-")) + if (strstr(val, "Control")) mod |= ControlMask; - if (strstr(val, "M1-")) + if (strstr(val, "Mod1") || strstr(val, "Alt")) mod |= Mod1Mask; - if (strstr(val, "M2-")) + if (strstr(val, "Mod2")) mod |= Mod2Mask; - if (strstr(val, "M3-")) + if (strstr(val, "Mod3")) mod |= Mod3Mask; - if (strstr(val, "M2-")) + if (strstr(val, "Mod4")) mod |= Mod4Mask; - if (strstr(val, "M5-")) + if (strstr(val, "Mod5")) mod |= Mod5Mask; return mod; }