From 6f260ba164ee302b50398e529f71e305e435504a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Aptel?= Date: Sun, 14 Aug 2011 17:13:59 +0200 Subject: fix custom key handling. --- st.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'st.c') diff --git a/st.c b/st.c index f0c2cd2..a60377b 100644 --- a/st.c +++ b/st.c @@ -43,6 +43,8 @@ #define ESC_ARG_SIZ 16 #define DRAW_BUF_SIZ 1024 #define UTF_SIZ 4 +#define XK_NO_MOD UINT_MAX +#define XK_ANY_MOD 0 #define SERRNO strerror(errno) #define MIN(a, b) ((a) < (b) ? (a) : (b)) @@ -1833,9 +1835,12 @@ focus(XEvent *ev) { char* kmap(KeySym k, unsigned int state) { int i; - for(i = 0; i < LEN(key); i++) - if(key[i].k == k && (key[i].mask == 0 || key[i].mask & state)) + state &= ~Mod2Mask; + for(i = 0; i < LEN(key); i++) { + unsigned int mask = key[i].mask; + if(key[i].k == k && ((state & mask) == mask || (mask == XK_NO_MOD && !state))) return (char*)key[i].s; + } return NULL; } -- cgit v1.2.3