diff options
author | Ori Bernstein <ori@eigenstate.org> | 2021-06-26 17:29:27 +0000 |
---|---|---|
committer | Ori Bernstein <ori@eigenstate.org> | 2021-06-26 17:29:27 +0000 |
commit | b68b3a6e19eb57c9f1c8b70b624f103254f4964a (patch) | |
tree | f34e4bed0c0f8c3d26b444ae9da24bcfb7c8cdc0 | |
parent | 4fd09def0fc51d0606e677f1ab59ad695d1cd780 (diff) | |
download | plan9front-b68b3a6e19eb57c9f1c8b70b624f103254f4964a.tar.xz |
vt, ssh: don't send interrupts on window resize
When resizing windows, vt would signal ssh by updating
the window size and sending an interrupt. Ssh reacted
by forwarding both the winch and an interrupt.
This change adds a WINCH generation counter so that
ssh can differentiate between resizes and interrupts.
If an interrupt comes in, and the WINCH generation
changes, then the interrupt is taken as signalling a
WINCH.
-rw-r--r-- | sys/src/cmd/ssh.c | 43 | ||||
-rw-r--r-- | sys/src/cmd/vt/main.c | 2 |
2 files changed, 30 insertions, 15 deletions
diff --git a/sys/src/cmd/ssh.c b/sys/src/cmd/ssh.c index 00733bdd7..e9021a53b 100644 --- a/sys/src/cmd/ssh.c +++ b/sys/src/cmd/ssh.c @@ -1090,13 +1090,22 @@ static struct { int ypixels; int lines; int cols; + int gen; } tty; -void +int getdim(void) { char *s; + int g; + if(s = getenv("WINCH")){ + g = atoi(s); + if(tty.gen == g) + return 0; + tty.gen = g; + free(s); + } if(s = getenv("XPIXELS")){ tty.xpixels = atoi(s); free(s); @@ -1113,6 +1122,7 @@ getdim(void) tty.cols = atoi(s); free(s); } + return 1; } void @@ -1175,6 +1185,7 @@ main(int argc, char *argv[]) fmtinstall('[', encodefmt); fmtinstall('k', kfmt); + tty.gen = -1; tty.term = getenv("TERM"); if(tty.term == nil) tty.term = ""; @@ -1403,20 +1414,22 @@ Mux: intr = 1; if(intr){ if(!raw) break; - getdim(); - sendpkt("busbuuuu", MSG_CHANNEL_REQUEST, - send.chan, - "window-change", 13, - 0, - tty.cols, - tty.lines, - tty.xpixels, - tty.ypixels); - sendpkt("busbs", MSG_CHANNEL_REQUEST, - send.chan, - "signal", 6, - 0, - "INT", 3); + if(getdim()){ + sendpkt("busbuuuu", MSG_CHANNEL_REQUEST, + send.chan, + "window-change", 13, + 0, + tty.cols, + tty.lines, + tty.xpixels, + tty.ypixels); + }else{ + sendpkt("busbs", MSG_CHANNEL_REQUEST, + send.chan, + "signal", 6, + 0, + "INT", 3); + } intr = 0; continue; } diff --git a/sys/src/cmd/vt/main.c b/sys/src/cmd/vt/main.c index 0622bb9ed..f1ed35b2b 100644 --- a/sys/src/cmd/vt/main.c +++ b/sys/src/cmd/vt/main.c @@ -61,6 +61,7 @@ int backc; int nbacklines; int xmax, ymax; int blocked; +int winchgen; int resize_flag = 1; int pagemode; int olines; @@ -867,6 +868,7 @@ putenvint(char *name, int x) void exportsize(void) { + putenvint("WINCH", ++winchgen); putenvint("XPIXELS", (xmax+1)*ftsize.x); putenvint("YPIXELS", (ymax+1)*ftsize.y); putenvint("LINES", ymax+1); |