tlibdraw: send hangup to process when window is lost - plan9port - [fork] Plan 9 from user space
 (HTM) git clone git://src.adamsgaard.dk/plan9port
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 40d787ab1276f191bcf030748a954d6708d83228
 (DIR) parent 9505cd15a64933bf58ec50548339cf98b1854646
 (HTM) Author: Russ Cox <rsc@swtch.com>
       Date:   Tue, 14 Jan 2020 18:05:51 -0500
       
       libdraw: send hangup to process when window is lost
       
       This matches the Plan 9 behavior a bit better.
       
       Fixes #30.
       
       Diffstat:
         M src/libdraw/mouse.c                 |       6 +++++-
       
       1 file changed, 5 insertions(+), 1 deletion(-)
       ---
 (DIR) diff --git a/src/libdraw/mouse.c b/src/libdraw/mouse.c
       t@@ -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);