libdraw: send hangup to process when window is lost

This matches the Plan 9 behavior a bit better.

Fixes #30.
This commit is contained in:
Russ Cox 2020-01-14 18:05:51 -05:00
parent 9505cd15a6
commit 40d787ab12

View file

@ -52,8 +52,12 @@ _ioproc(void *arg)
one = 1;
resized = 0;
for(;;){
if(_displayrdmouse(mc->display, &m, &resized) < 0)
if(_displayrdmouse(mc->display, &m, &resized) < 0) {
if(postnote(PNPROC, getpid(), "hangup") < 0)
fprint(2, "postnote: %r\n");
sleep(10*1000);
threadexitsall("mouse read error");
}
if(resized)
send(mc->resizec, &one);
send(mc->c, &m);