Xinqi Bao's Git
projects
/
st.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
inline
| side by side
Simplify logic in match().
[st.git]
/
st.c
diff --git
a/st.c
b/st.c
index
d0a6218
..
da2ce3f
100644
(file)
--- a/
st.c
+++ b/
st.c
@@
-3501,15
+3501,7
@@
focus(XEvent *ev) {
static inline bool
match(uint mask, uint state) {
static 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)
- return false;
- if(mask == XK_ANY_MOD)
- return true;
- return state == mask;
+ return mask == XK_ANY_MOD || mask == (state & ~ignoremod);
}
void
}
void
@@
-3579,7
+3571,6
@@
kpress(XEvent *ev) {
return;
len = XmbLookupString(xw.xic, e, buf, sizeof buf, &ksym, &status);
return;
len = XmbLookupString(xw.xic, e, buf, sizeof buf, &ksym, &status);
- e->state &= ~Mod2Mask;
/* 1. shortcuts */
for(bp = shortcuts; bp < shortcuts + LEN(shortcuts); bp++) {
if(ksym == bp->keysym && match(bp->mod, e->state)) {
/* 1. shortcuts */
for(bp = shortcuts; bp < shortcuts + LEN(shortcuts); bp++) {
if(ksym == bp->keysym && match(bp->mod, e->state)) {