~kris/9p

9hist

6c4e199c1606f6b033c590434062de6ff99f0b04 — David du Colombier 25 years ago 03275eb
Plan 9 from Bell Labs 2000-10-24
3 files changed, 10 insertions(+), 14 deletions(-)

M bitsy/devpenmouse.c
M bitsy/devµc.c
M bitsy/screen.c
M bitsy/devpenmouse.c => bitsy/devpenmouse.c +8 -11
@@ 90,11 90,12 @@ void
pentrackxy(int x, int y) {
	if (x == -1) {
		/* pen up. associate with button 1, 2, 3 up */
		if (mouse.buttons & 0x7)
			mouse.buttons &= ~0x7;
		mouse.buttons &= ~0x7;
	} else {
		x = (x<<16)/calibration.scalex + calibration.transx;
		y = (y<<16)/calibration.scaley + calibration.transy;
		if ((mouse.buttons & 0x7) == 0)
			mouse.buttons |= 0x1;
	}
	penmousetrack(mouse.buttons, x, y);
}


@@ 204,14 205,12 @@ penmouseclose(Chan *c)
	}
}


static long
penmouseread(Chan *c, void *va, long n, vlong)
{
	char buf[4*12+1];
	static int map[8] = {0, 4, 2, 6, 1, 5, 3, 7 };
	Mousestate m;
	int b;

	switch(c->qid.path){
	case CHDIR:


@@ 239,12 238,9 @@ penmouseread(Chan *c, void *va, long n, vlong)
			m = mouse.Mousestate;
		}

		b = buttonmap[m.buttons&7];
		/* put buttons 4 and 5 back in */
		b |= m.buttons & (3<<3);
		sprint(buf, "m%11d %11d %11d %11lud",
			m.xy.x, m.xy.y,
			b,
			m.buttons,
			m.msec);
		mouse.lastcounter = m.counter;
		if(n > 1+4*12)


@@ 303,7 299,7 @@ penmousewrite(Chan *c, void *va, long n, vlong)
{
	char *p;
	Point pt;
	char buf[64], *field[3];
	char buf[64], *field[5];
	int nf, b;

	p = va;


@@ 319,7 315,7 @@ penmousewrite(Chan *c, void *va, long n, vlong)
			buf[n-1] = 0;
		else
			buf[n] = 0;
		nf = getfields(buf, field, 3, 1, " ");
		nf = getfields(buf, field, 5, 1, " ");
		if(strcmp(field[0], "swap") == 0){
			if(mouseswap)
				setbuttonmap("123");


@@ 338,7 334,8 @@ penmousewrite(Chan *c, void *va, long n, vlong)
				calibration.scaley = strtol(field[2], nil, 0);
				calibration.transx = strtol(field[3], nil, 0);
				calibration.transy = strtol(field[4], nil, 0);
			}
			} else
				print("calibrate %d fields\n", nf);
		}
		return n;


M bitsy/devµc.c => bitsy/devµc.c +1 -1
@@ 118,7 118,7 @@ int
			b = p[0] & 0x7f;
			up = p[0] & 80;
	
			if(b > 5){
			if(b > 5) {
				/* rocker panel acts like arrow keys */
				if(b < 10)
					kbdputc(kbdq, bmap[b-6]);

M bitsy/screen.c => bitsy/screen.c +1 -2
@@ 228,7 228,7 @@ attachscreen(Rectangle *r, ulong *chan, int* d, int *width, int *softscreen)
	*width = gscreen->width;
	*softscreen = 0;

	return (uchar*)gscreen->data;
	return (uchar*)gscreen->data->bdata;
}

void


@@ 332,7 332,6 @@ screenputc(char *buf)
	Rectangle r;
	static int *xp;
	static int xbuf[256];
return;

	if(xp < xbuf || xp >= &xbuf[sizeof(xbuf)])
		xp = xbuf;