all repos — st @ f4a6c20f464df79a9b15b4a2a11daaa7a06c60a0

st (suckless terminal) config

Adding a way to ignore bits in the state.
Christoph Lohmann 20h@r-36.net
commit

f4a6c20f464df79a9b15b4a2a11daaa7a06c60a0

parent

e0ec2cf984ff8006b99cf4ca8590ceec7113daac

2 files changed, 9 insertions(+), 0 deletions(-)

jump to
M config.def.hconfig.def.h

@@ -104,6 +104,12 @@ * mapped below, add them to this array.

*/ static KeySym mappedkeys[] = { -1 }; +/* + * Which bits of the state should be ignored. By default the state bit for the + * keyboard layout (XK_SWITCH_MOD) is ignored. + */ +uint ignoremod = XK_SWITCH_MOD; + /* key, mask, output, keypad, cursor, crlf */ static Key key[] = { /* keysym mask string keypad cursor crlf */
M st.cst.c

@@ -61,6 +61,7 @@ #define STR_ARG_SIZ ESC_ARG_SIZ

#define DRAW_BUF_SIZ 20*1024 #define XK_ANY_MOD UINT_MAX #define XK_NO_MOD 0 +#define XK_SWITCH_MOD (1<<13) #define REDRAW_TIMEOUT (80*1000) /* 80 ms */

@@ -3008,6 +3009,8 @@ }

inline bool match(uint mask, uint state) { + state &= ~(ignoremod); + if(mask == XK_NO_MOD && state) return false; if(mask != XK_ANY_MOD && mask != XK_NO_MOD && !state)