From 6c4e199c1606f6b033c590434062de6ff99f0b04 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Tue, 24 Oct 2000 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 2000-10-24 --- bitsy/devpenmouse.c | 19 ++++++++----------- "bitsy/dev\302\265c.c" | 2 +- bitsy/screen.c | 3 +-- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/bitsy/devpenmouse.c b/bitsy/devpenmouse.c index 324ac12019956b559cea22a2f380563a8108cb89..58297343a0344ef32d9031049f11aa190c313b3d 100644 --- a/bitsy/devpenmouse.c +++ b/bitsy/devpenmouse.c @@ -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; diff --git "a/bitsy/dev\302\265c.c" "b/bitsy/dev\302\265c.c" index 049e372b9efae920ad02fb63c36fd2db0fe86f4c..15f421ac171a474e9b8198ac37f068a968c5738f 100644 --- "a/bitsy/dev\302\265c.c" +++ "b/bitsy/dev\302\265c.c" @@ -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]); diff --git a/bitsy/screen.c b/bitsy/screen.c index 29f0c1809e68638684e25998baa92b45bcc99a4f..7684358d12841e211115daca2f4710246ce0fff8 100644 --- a/bitsy/screen.c +++ b/bitsy/screen.c @@ -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;