9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: lucio@proxima.alt.za
To: 9fans@cse.psu.edu
Subject: [9fans] winwatch
Date: Mon,  1 Jan 2007 10:55:30 +0200	[thread overview]
Message-ID: <5ae4abb1c9261dbdfe9e4828d5620e27@proxima.alt.za> (raw)

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



             reply	other threads:[~2007-01-01  8:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-01  8:55 lucio [this message]
2007-01-02 22:34 ` David Leimbach
2007-01-03  4:02   ` lucio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5ae4abb1c9261dbdfe9e4828d5620e27@proxima.alt.za \
    --to=lucio@proxima.alt.za \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).