X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;ds=sidebyside;f=st.c;h=538ed9a4c21695bf2be39bed9fa6e8c7f1f5beb1;hb=2f215654a4b27eb573fb6551d28bdf760e95ef58;hp=3c158c055e3e971299b84461778b94578b050d91;hpb=21a0c4a2e08ede1d04c472497db7d9aef644d00c;p=st.git diff --git a/st.c b/st.c index 3c158c0..538ed9a 100644 --- a/st.c +++ b/st.c @@ -110,7 +110,8 @@ enum term_mode { MODE_MOUSEBTN = 32, MODE_MOUSEMOTION = 64, MODE_MOUSE = 32|64, - MODE_REVERSE = 128 + MODE_REVERSE = 128, + MODE_KBDLOCK = 256 }; enum escape_state { @@ -292,7 +293,7 @@ static void tfulldirt(void); static void ttynew(void); static void ttyread(void); -static void ttyresize(int, int); +static void ttyresize(void); static void ttywrite(const char *, size_t); static void xdraws(char *, Glyph, int, int, int, int); @@ -899,7 +900,7 @@ ttywrite(const char *s, size_t n) { } void -ttyresize(int x, int y) { +ttyresize(void) { struct winsize w; w.ws_row = term.row; @@ -952,6 +953,7 @@ treset(void) { term.tabs[i] = 1; term.top = 0, term.bot = term.row - 1; term.mode = MODE_WRAP; + xclear(0, 0, xw.w, xw.h); tclearregion(0, 0, term.col-1, term.row-1); } @@ -1327,6 +1329,9 @@ tsetmode(bool priv, bool set, int *args, int narg) { } } else { switch(*args) { + case 2: + MODBIT(term.mode, set, MODE_KBDLOCK); + break; case 4: MODBIT(term.mode, set, MODE_INSERT); break; @@ -2256,6 +2261,8 @@ kpress(XEvent *ev) { int shift; Status status; + if (IS_SET(MODE_KBDLOCK)) + return; meta = e->state & Mod1Mask; shift = e->state & ShiftMask; len = XmbLookupString(xw.xic, e, buf, sizeof(buf), &ksym, &status); @@ -2326,7 +2333,7 @@ resize(XEvent *e) { xclear(0, 0, xw.w, xw.h); tresize(col, row); xresize(col, row); - ttyresize(col, row); + ttyresize(); } void @@ -2433,9 +2440,9 @@ main(int argc, char *argv[]) { run: setlocale(LC_CTYPE, ""); + xinit(); tnew(80, 24); ttynew(); - xinit(); selinit(); run(); return 0;