aboutsummaryrefslogtreecommitdiff
path: root/st.c
diff options
context:
space:
mode:
authorAurélien Aptel <aurelien.aptel@gmail.com>2011-09-16 18:24:13 +0200
committerAurélien Aptel <aurelien.aptel@gmail.com>2011-09-16 18:24:13 +0200
commitb032814e25ddb166b4621262be4b8a1a0a609e37 (patch)
tree9afcd59da8592f63212605f9e95e5ab11aca3eef /st.c
parent8e66b5cc16831583a1086f3ba9cd0eaa55f02230 (diff)
parentf78b793d91f954c769e029fe6e1613c22d30f5cc (diff)
downloadst-b032814e25ddb166b4621262be4b8a1a0a609e37.tar.gz
st-b032814e25ddb166b4621262be4b8a1a0a609e37.tar.bz2
working on old repo, merging recent changesets.
Diffstat (limited to 'st.c')
-rw-r--r--st.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/st.c b/st.c
index 7ac02b9..c295de6 100644
--- a/st.c
+++ b/st.c
@@ -47,6 +47,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))
@@ -1840,9 +1842,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;
}