Add KAM sequence
This sequence lock/unlock the keyboard ignoring all the key pressing events from X server. --- st.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
This commit is contained in:
parent
11bec67875
commit
2f215654a4
8
st.c
8
st.c
|
@ -110,7 +110,8 @@ enum term_mode {
|
||||||
MODE_MOUSEBTN = 32,
|
MODE_MOUSEBTN = 32,
|
||||||
MODE_MOUSEMOTION = 64,
|
MODE_MOUSEMOTION = 64,
|
||||||
MODE_MOUSE = 32|64,
|
MODE_MOUSE = 32|64,
|
||||||
MODE_REVERSE = 128
|
MODE_REVERSE = 128,
|
||||||
|
MODE_KBDLOCK = 256
|
||||||
};
|
};
|
||||||
|
|
||||||
enum escape_state {
|
enum escape_state {
|
||||||
|
@ -1328,6 +1329,9 @@ tsetmode(bool priv, bool set, int *args, int narg) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch(*args) {
|
switch(*args) {
|
||||||
|
case 2:
|
||||||
|
MODBIT(term.mode, set, MODE_KBDLOCK);
|
||||||
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
MODBIT(term.mode, set, MODE_INSERT);
|
MODBIT(term.mode, set, MODE_INSERT);
|
||||||
break;
|
break;
|
||||||
|
@ -2257,6 +2261,8 @@ kpress(XEvent *ev) {
|
||||||
int shift;
|
int shift;
|
||||||
Status status;
|
Status status;
|
||||||
|
|
||||||
|
if (IS_SET(MODE_KBDLOCK))
|
||||||
|
return;
|
||||||
meta = e->state & Mod1Mask;
|
meta = e->state & Mod1Mask;
|
||||||
shift = e->state & ShiftMask;
|
shift = e->state & ShiftMask;
|
||||||
len = XmbLookupString(xw.xic, e, buf, sizeof(buf), &ksym, &status);
|
len = XmbLookupString(xw.xic, e, buf, sizeof(buf), &ksym, &status);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user