aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto E. Vargas Caballero <k0ga@shike2.com>2012-11-15 15:36:13 +0100
committerRoberto E. Vargas Caballero <k0ga@shike2.com>2012-11-15 15:36:13 +0100
commit88bb76c1bccbc8bb68b6776062cd2ef28bda8561 (patch)
tree98f887a38b895e34fac0140f608accebfdbef177
parent16ccf344deccbae53865b6efbe9dc23ebdceccb7 (diff)
downloadst-88bb76c1bccbc8bb68b6776062cd2ef28bda8561.tar.gz
st-88bb76c1bccbc8bb68b6776062cd2ef28bda8561.zip
Fix XK_NO_MOD and XK_ANY_MOD behavior
XK_NO_MOD match a key without modifiers and XK_ANY_MOD match a key does not matter what modifiers are pressed to. Like they are mask the best value for XK_ANY_MOD is all the bits to 1, so the and with any state will be equal to the state. This also imply that is necessary check the case for XK_NO_MOD (no modifiers at all) with some modifier in state, and the inverse (some mask different to XK_ANY_MOD or XK_NO_MOD and no modifiers in state). --- st.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
-rw-r--r--st.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/st.c b/st.c
index 932253c..b8b2bbf 100644
--- a/st.c
+++ b/st.c
@@ -59,8 +59,8 @@
59#define STR_ARG_SIZ 16 59#define STR_ARG_SIZ 16
60#define DRAW_BUF_SIZ 20*1024 60#define DRAW_BUF_SIZ 20*1024
61#define UTF_SIZ 4 61#define UTF_SIZ 4
62#define XK_NO_MOD UINT_MAX 62#define XK_ANY_MOD UINT_MAX
63#define XK_ANY_MOD 0 63#define XK_NO_MOD 0
64 64
65#define REDRAW_TIMEOUT (80*1000) /* 80 ms */ 65#define REDRAW_TIMEOUT (80*1000) /* 80 ms */
66 66
@@ -2700,10 +2700,12 @@ kmap(KeySym k, uint state) {
2700 if(kp->k != k) 2700 if(kp->k != k)
2701 continue; 2701 continue;
2702 2702
2703 if((state & mask) != mask && 2703 if(mask == XK_NO_MOD && state)
2704 (mask == XK_NO_MOD && state)) { 2704 continue;
2705 if(mask != XK_ANY_MOD && mask != XK_NO_MOD && !state)
2706 continue;
2707 if((state & mask) != state)
2705 continue; 2708 continue;
2706 }
2707 2709
2708 if((kp->appkey < 0 && IS_SET(MODE_APPKEYPAD)) || 2710 if((kp->appkey < 0 && IS_SET(MODE_APPKEYPAD)) ||
2709 (kp->appkey > 0 && !IS_SET(MODE_APPKEYPAD))) { 2711 (kp->appkey > 0 && !IS_SET(MODE_APPKEYPAD))) {