From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <5ae4abb1c9261dbdfe9e4828d5620e27@proxima.alt.za> To: 9fans@cse.psu.edu Date: Mon, 1 Jan 2007 10:55:30 +0200 From: lucio@proxima.alt.za MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: [9fans] winwatch Topicbox-Message-UUID: fc543b9e-ead1-11e9-9d60-3106f5b1d025 I replaced the code in click() with the following to add a half-baked facility to hide a window with winwatch. It uses the B3-B1 chord, but somehow loses the ability to pick a window with B3 when the winwatch window is not active. void click(Mouse m) { int fd, w, b = m.buttons; Point xy = m.xy; char buf[128]; do m = emouse(); while(m.buttons == b); while (b) { for(w = 0; w < nwin; w++) if(ptinrect(xy, win[w].r)) break; if(w < nwin) { sprint(buf, "/dev/wsys/%d/wctl", win[w].n); switch (b & 7) { case 1: break; case 2: case 3: break; case 4: case 6: case 7: if((fd = open(buf, OWRITE)) < 0) return; write(fd, "unhide\n", 7); write(fd, "top\n", 4); write(fd, "current\n", 8); close(fd); break; case 5: if((fd = open(buf, OWRITE)) < 0) return; write(fd, "top\n", 4); write(fd, "hide\n", 7); close(fd); break; } } b = m.buttons; xy = m.xy; do { m = emouse(); } while (m.buttons); } } I am a little disappointed as to how complicated it is to implement mouse functionality. It seems a lot easier to expect the interactive human to recover from unexpected conditions rather than try to design the interaction so no condition is unexpected. This is not a criticism of Plan 9, far from it. It is the realisation that by putting a computer on every desk we (computer programmer, glorified or otherwise) have turned computers from convenient slaves to eliminate tedium to instruments requiring constant human attention. ++L