| plan 9 kernel history: overview | file list | diff list |
1993/1008/port/devmouse.c (diff list | history)
| 1993/1006/sys/src/9/port/devmouse.c:251,257 – 1993/1008/sys/src/9/port/devmouse.c:251,257 (short | long) | ||
| 1993/1006 | long mouseread(Chan *c, void *va, long n, ulong offset) { | |
| 1993/1008 | char buf[4*12+1]; | |
| 1993/1006 | USED(offset); if(c->qid.path & CHDIR) | |
| 1993/1006/sys/src/9/port/devmouse.c:258,284 – 1993/1008/sys/src/9/port/devmouse.c:258,275 | ||
| 1993/1006 | return devdirread(c, va, n, mousedir, NMOUSE, devgen); if(c->qid.path == Qmouse){ | |
| 1993/1008 | sprint(buf, "%11d %11d %11d %11d", mouse.xy.x, mouse.xy.y, mouse.buttons, TK2MS(MACHP(0)->ticks)); | |
| 1993/1006 | mouse.lastcounter = mouse.counter; unlock(&cursor); | |
| 1993/1008 | if(n > 4*12) n = 4*12; memmove(va, buf, n); return n; | |
| 1993/1006 | } return 0; } | |
| 1993/1006/sys/src/9/port/devmouse.c:286,292 – 1993/1008/sys/src/9/port/devmouse.c:277,283 | ||
| 1993/1006 | long mousewrite(Chan *c, void *va, long n, ulong offset) { | |
| 1993/1008 | char *p; | |
| 1993/1006 | Point pt; char buf[64]; | |
| 1993/1006/sys/src/9/port/devmouse.c:305,316 – 1993/1008/sys/src/9/port/devmouse.c:296,311 | ||
| 1993/1006 | return n; case Qmouse: | |
| 1993/1008 | if(n > sizeof buf-1) n = sizeof buf -1; memmove(buf, va, n); buf[n] = 0; p = 0; pt.x = strtoul(buf, &p, 0); if(p == 0) | |
| 1993/1006 | error(Eshort); | |
| 1993/1008 | pt.y = strtoul(p, 0, 0); | |
| 1993/1006 | qlock(&mouse); | |
| 1993/1008/sys/src/9/port/devmouse.c:62,67 – 1993/1009/sys/src/9/port/devmouse.c:62,68 (short | long) | ||
| 1993/1006 | int mouseshifted; int mousetype; int hwcurs; | |
| 1993/1009 | Cursor curs; | |
| 1993/1006 | Cursor arrow = { | |
| 1993/1008/sys/src/9/port/devmouse.c:116,126 – 1993/1009/sys/src/9/port/devmouse.c:117,129 | ||
| 1993/1006 | enum{ Qdir, | |
| 1993/1009 | Qcursor, | |
| 1993/1006 | Qmouse, Qmousectl, }; Dirtab mousedir[]={ | |
| 1993/1009 | "cursor", {Qcursor}, 0, 0666, | |
| 1993/1006 | "mouse", {Qmouse}, 0, 0666, "mousectl", {Qmousectl}, 0, 0220, }; | |
| 1993/1008/sys/src/9/port/devmouse.c:141,146 – 1993/1009/sys/src/9/port/devmouse.c:144,150 | ||
| 1993/1006 | if(r == 0) flipping = 1; flipping = 0; /* howard, why is this necessary to get a black arrow on carrera? */ | |
| 1993/1009 | curs = arrow; | |
| 1993/1006 | Cursortocursor(&arrow); } | |
| 1993/1008/sys/src/9/port/devmouse.c:244,249 – 1993/1009/sys/src/9/port/devmouse.c:248,259 | ||
| 1993/1006 | lock(&mouse); if(c->qid.path == Qmouse) mouse.open = 0; | |
| 1993/1009 | if(--mouse.ref == 0){ cursoroff(1); curs = arrow; Cursortocursor(&arrow); cursoron(1); } | |
| 1993/1006 | unlock(&mouse); } } | |
| 1993/1008/sys/src/9/port/devmouse.c:252,263 – 1993/1009/sys/src/9/port/devmouse.c:262,289 | ||
| 1993/1006 | mouseread(Chan *c, void *va, long n, ulong offset) { | |
| 1993/1008 | char buf[4*12+1]; | |
| 1993/1009 | uchar *p; | |
| 1993/1006 |
| |
| 1993/1009 | p = va; switch(c->qid.path){ case CHDIR: | |
| 1993/1006 | return devdirread(c, va, n, mousedir, NMOUSE, devgen); | |
| 1993/1009 | case Qcursor: if(offset != 0) return 0; if(n < 2*4+2*2*16) error(Eshort); n = 2*4+2*2*16; lock(&cursor); BPLONG(p+0, curs.offset.x); BPLONG(p+4, curs.offset.y); memmove(p+8, curs.clr, 2*16); memmove(p+40, curs.set, 2*16); unlock(&cursor); return n; case Qmouse: | |
| 1993/1006 | while(mousechanged(0) == 0) sleep(&mouse.r, mousechanged, 0); lock(&cursor); | |
| 1993/1008/sys/src/9/port/devmouse.c:281,291 – 1993/1009/sys/src/9/port/devmouse.c:307,332 | ||
| 1993/1006 | Point pt; char buf[64]; | |
| 1993/1009 | p = va; | |
| 1993/1006 | switch(c->qid.path){ case CHDIR: error(Eisdir); | |
| 1993/1009 | case Qcursor: cursoroff(1); if(n < 2*4+2*2*16){ curs = arrow; Cursortocursor(&arrow); }else{ n = 2*4+2*2*16; curs.offset.x = BGLONG(p+0); curs.offset.y = BGLONG(p+4); memmove(curs.clr, p+8, 2*16); memmove(curs.set, p+40, 2*16); Cursortocursor(&curs); } cursoron(1); return n; | |
| 1993/1006 | case Qmousectl: if(n >= sizeof(buf)) | |
| 1993/1009/sys/src/9/port/devmouse.c:54,59 – 1993/1026/sys/src/9/port/devmouse.c:54,60 (short | long) | ||
| 1993/1006 | Lock; int visible; /* on screen */ int disable; /* from being used */ | |
| 1993/1026 | int frozen; /* from being used */ | |
| 1993/1006 | Rectangle r; /* location */ }; | |
| 1993/1009/sys/src/9/port/devmouse.c:379,384 – 1993/1026/sys/src/9/port/devmouse.c:380,412 | ||
| 1993/1006 | } if(hwcurs) hwcursset(set.base, clr.base, cursor.offset.x, cursor.offset.y); | |
| 1993/1026 | unlock(&cursor); } void cursorlock(Rectangle r) { if(hwcurs) return; lock(&cursor); if(rectXrect(cursor.r, r)){ cursoroff(0); cursor.frozen = 1; } cursor.disable++; unlock(&cursor); } void cursorunlock(void) { if(hwcurs) return; lock(&cursor); cursor.disable--; if(cursor.frozen) cursoron(0); cursor.frozen = 0; | |
| 1993/1006 | unlock(&cursor); } | |
| 1993/1026/sys/src/9/port/devmouse.c:326,331 – 1993/1108/sys/src/9/port/devmouse.c:326,335 (short | long) | ||
| 1993/1009 | memmove(curs.set, p+40, 2*16); Cursortocursor(&curs); } | |
| 1993/1108 | qlock(&mouse); mouse.redraw = 1; mouseclock(); qunlock(&mouse); | |
| 1993/1009 | cursoron(1); return n; | |
| 1993/1006 | ||
| 1993/1108/sys/src/9/port/devmouse.c:516,522 – 1993/1201/sys/src/9/port/devmouse.c:516,522 (short | long) | ||
| 1993/1006 | * shift & right button is the same as middle button (for 2 button mice) */ int | |
| 1993/1201 | m3mouseputc(int c) | |
| 1993/1006 | { static uchar msg[3]; static int nb; | |
| 1993/1108/sys/src/9/port/devmouse.c:525,531 – 1993/1201/sys/src/9/port/devmouse.c:525,530 | ||
| 1993/1006 | short x; int dx, dy, newbuttons; | |
| 1993/1108/sys/src/9/port/devmouse.c:557,563 – 1993/1201/sys/src/9/port/devmouse.c:556,562 | ||
| 1993/1006 | * shift & right button is the same as middle button (for 2 button mice) */ int | |
| 1993/1201 | mouseputc(int c) | |
| 1993/1006 | { static short msg[5]; static int nb; | |
| 1993/1108/sys/src/9/port/devmouse.c:564,570 – 1993/1201/sys/src/9/port/devmouse.c:563,568 | ||
| 1993/1006 | static uchar b[] = {0, 4, 2, 6, 1, 5, 3, 7, 0, 2, 2, 6, 1, 5, 3, 7}; int dx, dy, newbuttons; | |
| 1993/1201/sys/src/9/port/devmouse.c:8,13 – 1994/0210/sys/src/9/port/devmouse.c:8,14 (short | long) | ||
| 1993/1006 | #include "../port/error.h" #include "devtab.h" | |
| 1994/0210 | #include "screen.h" | |
| 1993/1006 | /* * Some monochrome screens are reversed from what we like: | |
| 1994/0210/sys/src/9/port/devmouse.c:63,68 – 1994/0216/sys/src/9/port/devmouse.c:63,69 (short | long) | ||
| 1993/1006 | Cursorinfo cursor; int mouseshifted; int mousetype; | |
| 1994/0216 | int mouseswap; | |
| 1993/1006 | int hwcurs; | |
| 1993/1009 | Cursor curs; | |
| 1993/1006 | ||
| 1994/0210/sys/src/9/port/devmouse.c:260,270 – 1994/0216/sys/src/9/port/devmouse.c:261,273 | ||
| 1993/1006 | } } | |
| 1994/0216 | ||
| 1993/1006 | long mouseread(Chan *c, void *va, long n, ulong offset) { | |
| 1993/1008 | char buf[4*12+1]; | |
| 1993/1009 | uchar *p; | |
| 1994/0216 | static int map[8] = {0, 4, 2, 6, 1, 5, 3, 7 }; | |
| 1993/1006 | ||
| 1993/1009 | p = va; switch(c->qid.path){ | |
| 1994/0210/sys/src/9/port/devmouse.c:290,296 – 1994/0216/sys/src/9/port/devmouse.c:293,300 | ||
| 1993/1006 | sleep(&mouse.r, mousechanged, 0); lock(&cursor); | |
| 1993/1008 | sprint(buf, "%11d %11d %11d %11d", | |
| 1994/0216 | mouse.xy.x, mouse.xy.y, mouseswap ? map[mouse.buttons&7] : mouse.buttons, | |
| 1993/1008 | TK2MS(MACHP(0)->ticks)); | |
| 1993/1006 | mouse.lastcounter = mouse.counter; unlock(&cursor); | |
| 1994/0216/sys/src/9/port/devmouse.c:313,318 – 1994/0325/sys/src/9/port/devmouse.c:313,319 (short | long) | ||
| 1993/1006 | Point pt; char buf[64]; | |
| 1994/0325 | USED(offset); | |
| 1993/1009 | p = va; | |
| 1993/1006 | switch(c->qid.path){ case CHDIR: | |
| 1994/0325/sys/src/9/port/devmouse.c:115,123 – 1994/0412/sys/src/9/port/devmouse.c:115,137 (short | long) | ||
| 1993/1006 | {0, 0, 16, 16} }; | |
| 1994/0412 | ulong cursorworkbits[16*4]; GBitmap cursorwork = { cursorworkbits, 0, 1, 0, {0, 0, 16, 16}, {0, 0, 16, 16} }; | |
| 1993/1006 | void Cursortocursor(Cursor*); int mousechanged(void*); | |
| 1994/0412 | extern void screenload(Rectangle, uchar*, int, int, int); extern void screenunload(Rectangle, uchar*, int, int, int); | |
| 1993/1006 | enum{ Qdir, | |
| 1993/1009 | Qcursor, | |
| 1994/0325/sys/src/9/port/devmouse.c:156,166 – 1994/0412/sys/src/9/port/devmouse.c:170,183 | ||
| 1993/1006 | { if(!conf.monitor) return; | |
| 1994/0412 | if(gscreen.ldepth > 3){ | |
| 1993/1006 | cursorback.ldepth = 0; | |
| 1994/0412 | cursorwork.ldepth = 0; }else{ | |
| 1993/1006 | cursorback.ldepth = gscreen.ldepth; cursorback.width = ((16 << gscreen.ldepth) + 31) >> 5; | |
| 1994/0412 | cursorwork.ldepth = gscreen.ldepth; cursorwork.width = ((16 << gscreen.ldepth) + 31) >> 5; | |
| 1993/1006 | } cursoron(1); } | |
| 1994/0325/sys/src/9/port/devmouse.c:434,445 – 1994/0412/sys/src/9/port/devmouse.c:451,465 | ||
| 1993/1006 | cursor.r.min = mouse.xy; cursor.r.max = add(mouse.xy, Pt(16, 16)); cursor.r = raddp(cursor.r, cursor.offset); | |
| 1994/0412 | screenunload(cursor.r, (uchar*)cursorworkbits, (16>>3) << gscreen.ldepth, cursorwork.width*BY2WD, 0); memmove(cursorbackbits, cursorworkbits, 16*cursorback.width*BY2WD); gbitblt(&cursorwork, cursorwork.r.min, | |
| 1993/1006 | &clr, Rect(0, 0, 16, 16), flipping? flipD[D&~S] : D&~S); | |
| 1994/0412 | gbitblt(&cursorwork, cursorwork.r.min, | |
| 1993/1006 | &set, Rect(0, 0, 16, 16), flipping? flipD[S|D] : S|D); | |
| 1994/0412 | screenload(cursor.r, (uchar*)cursorworkbits, (16>>3) << gscreen.ldepth, cursorwork.width*BY2WD, 0); | |
| 1993/1006 | } } if(dolock) | |
| 1994/0325/sys/src/9/port/devmouse.c:454,464 – 1994/0412/sys/src/9/port/devmouse.c:474,482 | ||
| 1993/1006 | if(dolock) lock(&cursor); if(--cursor.visible == 0) { | |
| 1994/0412 | if(!hwcurs) screenload(cursor.r, (uchar*)cursorbackbits, (16>>3) << gscreen.ldepth, cursorback.width*BY2WD, 0); | |
| 1993/1006 | } if(dolock) unlock(&cursor); | |
| 1994/0325/sys/src/9/port/devmouse.c:480,486 – 1994/0412/sys/src/9/port/devmouse.c:498,503 | ||
| 1993/1006 | mouse.redraw = 0; cursoroff(0); cursoron(0); | |
| 1994/0412/sys/src/9/port/devmouse.c:1,7 – 1994/0413/sys/src/9/port/devmouse.c:1,6 (short | long) | ||
| 1993/1006 | #include "u.h" #include "../port/lib.h" #include <libg.h> | |
| 1994/0412/sys/src/9/port/devmouse.c:57,62 – 1994/0413/sys/src/9/port/devmouse.c:56,67 | ||
| 1993/1006 | int disable; /* from being used */ | |
| 1993/1026 | int frozen; /* from being used */ | |
| 1993/1006 | Rectangle r; /* location */ | |
| 1994/0413 | int l; int tl; int setop; int clrop; Rectangle clipr; | |
| 1993/1006 | }; Mouseinfo mouse; | |
| 1994/0412/sys/src/9/port/devmouse.c:83,129 – 1994/0413/sys/src/9/port/devmouse.c:88,124 | ||
| 1993/1006 | }; ulong setbits[16]; | |
| 1994/0413 | Bitmap set = | |
| 1993/1006 | { | |
| 1994/0413 | {0, 0, 16, 16}, {0, 0, 16, 16}, | |
| 1993/1006 | 0, | |
| 1994/0413 | setbits, | |
| 1993/1006 | 1, 0, | |
| 1994/0413 | Bitmap clr = | |
| 1993/1006 | { | |
| 1994/0413 | {0, 0, 16, 16}, | |
| 1993/1006 | 0, | |
| 1994/0413 | clrbits, | |
| 1993/1006 | 1, 0, | |
| 1994/0412 |
| |
| 1994/0413 | ulong backbits[16*5]; ulong workbits[16*5]; Bitmap cursorwork = | |
| 1994/0412 | { | |
| 1994/0413 | {0, 0, 16+8, 16}, {0, 0, 16+8, 16}, | |
| 1994/0412 | 0, | |
| 1994/0413 | workbits, | |
| 1994/0412 | 1, 0, | |
| 1993/1006 | void Cursortocursor(Cursor*); | |
| 1994/0412/sys/src/9/port/devmouse.c:147,153 – 1994/0413/sys/src/9/port/devmouse.c:142,148 | ||
| 1993/1006 | #define NMOUSE (sizeof(mousedir)/sizeof(Dirtab)) | |
| 1994/0413 | extern Bitmap gscreen; | |
| 1993/1006 | void mousereset(void) | |
| 1994/0412/sys/src/9/port/devmouse.c:166,184 – 1994/0413/sys/src/9/port/devmouse.c:161,195 | ||
| 1993/1006 | } void | |
| 1994/0413 | cursorinit(void) { cursorwork.ldepth = gscreen.ldepth; cursorwork.width = ((cursorwork.r.max.x << gscreen.ldepth) + 31) >> 5; cursor.l = cursorwork.width*BY2WD; if(flipping){ cursor.setop = flipD[S|D]; cursor.clrop = flipD[D&~S]; } else { cursor.setop = S|D; cursor.clrop = D&~S; } } void | |
| 1993/1006 | mouseinit(void) { if(!conf.monitor) return; | |
| 1994/0413 | ||
| 1994/0412 | if(gscreen.ldepth > 3){ | |
| 1993/1006 |
| |
| 1994/0412 |
| |
| 1993/1006 |
| |
| 1994/0412 |
| |
| 1994/0413 | print("mouse can't work ldepth > 3"); cursor.disable = 1; | |
| 1993/1006 | } | |
| 1994/0413 | cursorinit(); | |
| 1993/1006 | cursoron(1); } | |
| 1994/0412/sys/src/9/port/devmouse.c:187,192 – 1994/0413/sys/src/9/port/devmouse.c:198,204 | ||
| 1993/1006 | { if(!conf.monitor) error(Egreg); | |
| 1994/0413 | cursorinit(); | |
| 1993/1006 | return devattach('m', spec); } | |
| 1994/0412/sys/src/9/port/devmouse.c:437,445 – 1994/0413/sys/src/9/port/devmouse.c:449,472 | ||
| 1993/1006 | unlock(&cursor); } | |
| 1994/0413 | typedef struct { Bitmap *dm; Point p; Bitmap *sm; Rectangle r; Fcode f; } XXX; | |
| 1993/1006 | void cursoron(int dolock) { | |
| 1994/0413 | int off; Rectangle r; uchar *a; XXX x; extern int graphicssubtile(uchar*, int, int, Rectangle, Rectangle, uchar**); | |
| 1993/1006 | if(cursor.disable) return; if(dolock) | |
| 1994/0412/sys/src/9/port/devmouse.c:451,465 – 1994/0413/sys/src/9/port/devmouse.c:478,513 | ||
| 1993/1006 | cursor.r.min = mouse.xy; cursor.r.max = add(mouse.xy, Pt(16, 16)); cursor.r = raddp(cursor.r, cursor.offset); | |
| 1994/0412 |
| |
| 1993/1006 |
| |
| 1994/0412 |
| |
| 1993/1006 |
| |
| 1994/0412 |
| |
| 1994/0413 | /* bit offset into backup area */ off = ((1<<gscreen.ldepth)*cursor.r.min.x) & 7; /* clip the cursor rectangle */ x.dm = &cursorwork; x.p = Pt(off, 0); x.sm = &gscreen; x.r = cursor.r; bitbltclip(&x); /* tile width */ cursor.tl = graphicssubtile(0, cursor.l, gscreen.ldepth, gscreen.r, x.r, &a); if(cursor.tl > 0){ /* get tile */ screenunload(x.r, (uchar*)workbits, cursor.tl, cursor.l, 0); /* save for cursoroff */ memmove(backbits, workbits, cursor.l*16); /* add mouse into work area */ r = Rect(0, 0, Dx(x.r), Dy(x.r)); bitblt(&cursorwork, x.p, &clr, r, cursor.clrop); bitblt(&cursorwork, x.p, &set, r, cursor.setop); /* put back tile */ cursor.clipr = x.r; screenload(x.r, (uchar*)workbits, cursor.tl, cursor.l, 0); } | |
| 1993/1006 | } } if(dolock) | |
| 1994/0412/sys/src/9/port/devmouse.c:473,483 – 1994/0413/sys/src/9/port/devmouse.c:521,528 | ||
| 1993/1006 | return; if(dolock) lock(&cursor); | |
| 1994/0412 |
| |
| 1993/1006 |
| |
| 1994/0413 | if(--cursor.visible == 0 && !hwcurs && cursor.tl > 0) screenload(cursor.clipr, (uchar*)backbits, cursor.tl, cursor.l, 0); | |
| 1993/1006 | if(dolock) unlock(&cursor); } | |
| 1994/0413/sys/src/9/port/devmouse.c:9,34 – 1994/0414/sys/src/9/port/devmouse.c:9,15 (short | long) | ||
| 1993/1006 | #include "devtab.h" | |
| 1994/0210 | #include "screen.h" | |
| 1993/1006 |
| |
| 1994/0413/sys/src/9/port/devmouse.c:48,76 – 1994/0414/sys/src/9/port/devmouse.c:29,40 | ||
| 1993/1006 | int open; }; | |
| 1993/1026 |
| |
| 1993/1006 |
| |
| 1994/0413 |
| |
| 1993/1006 |
| |
| 1994/0216 | int mouseswap; | |
| 1993/1006 |
| |
| 1993/1009 |
| |
| 1994/0414 | Cursor curs; | |
| 1993/1006 | Cursor arrow = { | |
| 1994/0413/sys/src/9/port/devmouse.c:88,132 – 1994/0414/sys/src/9/port/devmouse.c:52,62 | ||
| 1993/1006 | }; ulong setbits[16]; | |
| 1994/0413 |
| |
| 1993/1006 |
| |
| 1994/0413 |
| |
| 1993/1006 |
| |
| 1994/0413 |
| |
| 1993/1006 |
| |
| 1994/0413 |
| |
| 1993/1006 |
| |
| 1994/0413 |
| |
| 1993/1006 |
| |
| 1994/0413 |
| |
| 1993/1006 |
| |
| 1994/0413 |
| |
| 1994/0412 |
| |
| 1994/0413 |
| |
| 1994/0412 |
| |
| 1994/0413 |
| |
| 1994/0412 |
| |
| 1993/1006 | void Cursortocursor(Cursor*); int mousechanged(void*); | |
| 1994/0412 |
| |
| 1993/1006 | enum{ Qdir, | |
| 1993/1009 | Qcursor, | |
| 1994/0413/sys/src/9/port/devmouse.c:147,195 – 1994/0414/sys/src/9/port/devmouse.c:77,95 | ||
| 1993/1006 | void mousereset(void) { | |
| 1993/1009 | curs = arrow; | |
| 1993/1006 | Cursortocursor(&arrow); } void | |
| 1994/0413 |
| |
| 1993/1006 | mouseinit(void) { if(!conf.monitor) return; | |
| 1994/0413 | ||
| 1994/0412 |
| |
| 1994/0413 |
| |
| 1993/1006 |
| |
| 1994/0413 |
| |
| 1993/1006 | cursoron(1); } | |
| 1994/0413/sys/src/9/port/devmouse.c:198,204 – 1994/0414/sys/src/9/port/devmouse.c:98,103 | ||
| 1993/1006 | { if(!conf.monitor) error(Egreg); | |
| 1994/0413 |
| |
| 1993/1006 | return devattach('m', spec); } | |
| 1994/0413/sys/src/9/port/devmouse.c:408,414 – 1994/0414/sys/src/9/port/devmouse.c:307,313 | ||
| 1993/1006 | uchar *p; lock(&cursor); | |
| 1994/0414 | memmove(&cursor.Cursor, c, sizeof(Cursor)); | |
| 1993/1006 | for(i=0; i<16; i++){ p = (uchar*)&setbits[i]; *p = c->set[2*i]; | |
| 1994/0413/sys/src/9/port/devmouse.c:417,532 – 1994/0414/sys/src/9/port/devmouse.c:316,326 | ||
| 1993/1006 | *p = c->clr[2*i]; *(p+1) = c->clr[2*i+1]; } | |
| 1994/0414 | setcursor(setbits, clrbits, cursor.offset.x, cursor.offset.y); | |
| 1993/1026 | unlock(&cursor); } | |
| 1993/1006 |
| |
| 1994/0413 |
| |
| 1993/1006 |
| |
| 1994/0413 |
| |
| 1993/1006 |
| |
| 1994/0413 |
| |
| 1993/1006 |
| |
| 1994/0413 |
| |
| 1993/1006 |
| |
| 1994/0413/sys/src/9/port/devmouse.c:651,654 – 1994/0414/sys/src/9/port/devmouse.c:445,454 | ||
| 1993/1006 | { USED(m); return mouse.lastcounter - mouse.counter; | |
| 1994/0414 | } Point mousexy(void) { return mouse.xy; | |
| 1993/1006 | } | |
| 1994/0414/sys/src/9/port/devmouse.c:51,59 – 1994/0520/sys/src/9/port/devmouse.c:51,56 (short | long) | ||
| 1993/1006 | } }; | |
| 1994/0414/sys/src/9/port/devmouse.c:303,322 – 1994/0520/sys/src/9/port/devmouse.c:300,308 | ||
| 1993/1006 | void Cursortocursor(Cursor *c) { | |
| 1994/0414 | memmove(&cursor.Cursor, c, sizeof(Cursor)); | |
| 1993/1006 |
| |
| 1994/0414 |
| |
| 1994/0520 | setcursor(c); | |
| 1993/1026 | unlock(&cursor); } | |
| 1994/0520/sys/src/9/port/devmouse.c:36,54 – 1994/0521/sys/src/9/port/devmouse.c:36,53 (short | long) | ||
| 1994/0216 | int mouseswap; | |
| 1994/0414 | Cursor curs; | |
| 1993/1006 |
| |
| 1994/0521 | Cursor arrow = { { -1, -1 }, { 0xFF, 0xFF, 0x80, 0x01, 0x80, 0x02, 0x80, 0x0C, 0x80, 0x10, 0x80, 0x10, 0x80, 0x08, 0x80, 0x04, 0x80, 0x02, 0x80, 0x01, 0x80, 0x02, 0x8C, 0x04, 0x92, 0x08, 0x91, 0x10, 0xA0, 0xA0, 0xC0, 0x40, | |
| 1993/1006 | }, | |
| 1994/0521 | { 0x00, 0x00, 0x7F, 0xFE, 0x7F, 0xFC, 0x7F, 0xF0, 0x7F, 0xE0, 0x7F, 0xE0, 0x7F, 0xF0, 0x7F, 0xF8, 0x7F, 0xFC, 0x7F, 0xFE, 0x7F, 0xFC, 0x73, 0xF8, 0x61, 0xF0, 0x60, 0xE0, 0x40, 0x40, 0x00, 0x00, }, | |
| 1993/1006 | }; void Cursortocursor(Cursor*); | |
| 1994/0521/sys/src/9/port/devmouse.c:321,327 – 1994/0624/sys/src/9/port/devmouse.c:321,327 (short | long) | ||
| 1993/1006 | if(mouse.redraw && canlock(&cursor)){ mouse.redraw = 0; cursoroff(0); | |
| 1994/0624 | mouse.redraw = cursoron(0); | |
| 1993/1006 | unlock(&cursor); } } | |
| 1994/0624/sys/src/9/port/devmouse.c:363,369 – 1994/0730/sys/src/9/port/devmouse.c:363,369 (short | long) | ||
| 1993/1006 | * shift & right button is the same as middle button (for 2 button mice) */ int | |
| 1993/1201 |
| |
| 1994/0730 | m3mouseputc(void *q, int c) | |
| 1993/1006 | { static uchar msg[3]; static int nb; | |
| 1994/0624/sys/src/9/port/devmouse.c:372,377 – 1994/0730/sys/src/9/port/devmouse.c:372,379 | ||
| 1993/1006 | short x; int dx, dy, newbuttons; | |
| 1994/0730 | USED(q); | |
| 1993/1006 | /* * check bit 6 for consistency */ | |
| 1994/0624/sys/src/9/port/devmouse.c:403,409 – 1994/0730/sys/src/9/port/devmouse.c:405,411 | ||
| 1993/1006 | * shift & right button is the same as middle button (for 2 button mice) */ int | |
| 1993/1201 |
| |
| 1994/0730 | mouseputc(void *q, int c) | |
| 1993/1006 | { static short msg[5]; static int nb; | |
| 1994/0624/sys/src/9/port/devmouse.c:410,415 – 1994/0730/sys/src/9/port/devmouse.c:412,418 | ||
| 1993/1006 | static uchar b[] = {0, 4, 2, 6, 1, 5, 3, 7, 0, 2, 2, 6, 1, 5, 3, 7}; int dx, dy, newbuttons; | |
| 1994/0730 | USED(q); | |
| 1993/1006 | if((c&0xF0) == 0x80) nb=0; msg[nb] = c; | |
| 1994/0730/sys/src/9/port/devmouse.c:324,329 – 1994/0913/sys/src/9/port/devmouse.c:324,330 (short | long) | ||
| 1994/0624 | mouse.redraw = cursoron(0); | |
| 1993/1006 | unlock(&cursor); } | |
| 1994/0913 | graphicsactive(0); | |
| 1993/1006 | } /* | |
| 1994/0730/sys/src/9/port/devmouse.c:350,355 – 1994/0913/sys/src/9/port/devmouse.c:351,357 | ||
| 1993/1006 | mouse.buttons = b; mouse.redraw = 1; wakeup(&mouse.r); | |
| 1994/0913 | graphicsactive(1); | |
| 1993/1006 | } /* | |
| 1994/0913/sys/src/9/port/devmouse.c:216,229 – 1994/1013/sys/src/9/port/devmouse.c:216,229 (short | long) | ||
| 1993/1006 | while(mousechanged(0) == 0) sleep(&mouse.r, mousechanged, 0); lock(&cursor); | |
| 1993/1008 |
| |
| 1994/1013 | sprint(buf, "m%11d %11d %11d %11d", | |
| 1994/0216 | mouse.xy.x, mouse.xy.y, mouseswap ? map[mouse.buttons&7] : mouse.buttons, | |
| 1993/1008 | TK2MS(MACHP(0)->ticks)); | |
| 1993/1006 | mouse.lastcounter = mouse.counter; unlock(&cursor); | |
| 1993/1008 |
| |
| 1994/1013 | if(n > 1+4*12) n = 1+4*12; | |
| 1993/1008 | memmove(va, buf, n); return n; | |
| 1993/1006 | } | |
| 1994/0913/sys/src/9/port/devmouse.c:277,283 – 1994/1013/sys/src/9/port/devmouse.c:277,283 | ||
| 1993/1008 | memmove(buf, va, n); buf[n] = 0; p = 0; | |
| 1994/1013 | pt.x = strtoul(buf+1, &p, 0); | |
| 1993/1008 | if(p == 0) | |
| 1993/1006 | error(Eshort); | |
| 1993/1008 | pt.y = strtoul(p, 0, 0); | |
| 1994/1013/sys/src/9/port/devmouse.c:230,235 – 1995/0108/sys/src/9/port/devmouse.c:230,241 (short | long) | ||
| 1993/1006 | return 0; } | |
| 1995/0108 | Block* mousebread(Chan *c, long n, ulong offset) { return devbread(c, n, offset); } | |
| 1993/1006 | long mousewrite(Chan *c, void *va, long n, ulong offset) { | |
| 1994/1013/sys/src/9/port/devmouse.c:294,299 – 1995/0108/sys/src/9/port/devmouse.c:300,311 | ||
| 1993/1006 | error(Egreg); return -1; | |
| 1995/0108 | } long mousebwrite(Chan *c, Block *bp, ulong offset) { return devbwrite(c, bp, offset); | |
| 1993/1006 | } void | |
| 1995/0108/sys/src/9/port/devmouse.c:146,170 – 1995/0804/sys/src/9/port/devmouse.c:146,167 (short | long) | ||
| 1993/1006 | } void | |
| 1995/0804 | mousecreate(Chan*, char*, int, ulong) | |
| 1993/1006 | { if(!conf.monitor) error(Egreg); | |
| 1995/0804 | mouseremove(Chan*) | |
| 1993/1006 | { | |
| 1995/0804 | mousewstat(Chan*, char*) | |
| 1993/1006 | { | |
| 1995/0108/sys/src/9/port/devmouse.c:237,249 – 1995/0804/sys/src/9/port/devmouse.c:234,245 | ||
| 1995/0108 | } | |
| 1993/1006 | long | |
| 1995/0804 | mousewrite(Chan *c, void *va, long n, ulong) | |
| 1993/1006 | { | |
| 1993/1008 | char *p; | |
| 1993/1006 | Point pt; char buf[64]; | |
| 1994/0325 |
| |
| 1993/1009 | p = va; | |
| 1993/1006 | switch(c->qid.path){ case CHDIR: | |
| 1995/0108/sys/src/9/port/devmouse.c:377,383 – 1995/0804/sys/src/9/port/devmouse.c:373,379 | ||
| 1993/1006 | * shift & right button is the same as middle button (for 2 button mice) */ int | |
| 1994/0730 |
| |
| 1995/0804 | m3mouseputc(void*, int c) | |
| 1993/1006 | { static uchar msg[3]; static int nb; | |
| 1995/0108/sys/src/9/port/devmouse.c:386,393 – 1995/0804/sys/src/9/port/devmouse.c:382,387 | ||
| 1993/1006 | short x; int dx, dy, newbuttons; | |
| 1994/0730 |
| |
| 1993/1006 | /* * check bit 6 for consistency */ | |
| 1995/0108/sys/src/9/port/devmouse.c:419,425 – 1995/0804/sys/src/9/port/devmouse.c:413,419 | ||
| 1993/1006 | * shift & right button is the same as middle button (for 2 button mice) */ int | |
| 1994/0730 |
| |
| 1995/0804 | mouseputc(void*, int c) | |
| 1993/1006 | { static short msg[5]; static int nb; | |
| 1995/0108/sys/src/9/port/devmouse.c:426,432 – 1995/0804/sys/src/9/port/devmouse.c:420,425 | ||
| 1993/1006 | static uchar b[] = {0, 4, 2, 6, 1, 5, 3, 7, 0, 2, 2, 6, 1, 5, 3, 7}; int dx, dy, newbuttons; | |
| 1994/0730 |
| |
| 1993/1006 | if((c&0xF0) == 0x80) nb=0; msg[nb] = c; | |
| 1995/0108/sys/src/9/port/devmouse.c:443,451 – 1995/0804/sys/src/9/port/devmouse.c:436,443 | ||
| 1993/1006 | } int | |
| 1995/0804 | mousechanged(void*) | |
| 1993/1006 | { | |
| 1994/0414 | } | |
| 1995/0804/sys/src/9/port/devmouse.c:212,218 – 1995/0812/sys/src/9/port/devmouse.c:212,221 (short | long) | ||
| 1993/1009 | case Qmouse: | |
| 1993/1006 | while(mousechanged(0) == 0) sleep(&mouse.r, mousechanged, 0); | |
| 1995/0812 | while(!canlock(&cursor)) tsleep(&up->sleep, return0, 0, TK2MS(1)); | |
| 1994/1013 | sprint(buf, "m%11d %11d %11d %11d", | |
| 1994/0216 | mouse.xy.x, mouse.xy.y, mouseswap ? map[mouse.buttons&7] : mouse.buttons, | |
| 1995/0812/sys/src/9/port/devmouse.c:27,32 – 1995/1216/sys/src/9/port/devmouse.c:27,34 (short | long) | ||
| 1993/1006 | Ref; QLock; int open; | |
| 1995/1216 | int acceleration; int maxacc; | |
| 1993/1006 | }; Mouseinfo mouse; | |
| 1995/0812/sys/src/9/port/devmouse.c:272,278 – 1995/1216/sys/src/9/port/devmouse.c:274,283 | ||
| 1993/1006 | if(n >= sizeof(buf)) n = sizeof(buf)-1; strncpy(buf, va, n); | |
| 1995/1216 | if(buf[n - 1] == '\n') buf[n-1] = 0; else buf[n] = 0; | |
| 1993/1006 | mousectl(buf); return n; | |
| 1995/0812/sys/src/9/port/devmouse.c:338,343 – 1995/1216/sys/src/9/port/devmouse.c:343,376 | ||
| 1994/0913 | graphicsactive(0); | |
| 1993/1006 | } | |
| 1995/1216 | static int scale(int x) { int sign = 1; if(x < 0){ sign = -1; x = -x; } switch(x){ case 0: case 1: case 2: case 3: break; case 4: x = 6 + (mouse.acceleration>>2); break; case 5: x = 9 + (mouse.acceleration>>1); break; default: x *= mouse.maxacc; break; } return sign*x; } | |
| 1993/1006 | /* * called at interrupt level to update the structure and * awaken any waiting procs. | |
| 1995/0812/sys/src/9/port/devmouse.c:347,352 – 1995/1216/sys/src/9/port/devmouse.c:380,389 | ||
| 1993/1006 | { int x, y; | |
| 1995/1216 | if(mouse.acceleration){ dx = scale(dx); dy = scale(dy); } | |
| 1993/1006 | x = mouse.xy.x + dx; if(x < gscreen.r.min.x) x = gscreen.r.min.x; | |
| 1995/0812/sys/src/9/port/devmouse.c:448,451 – 1995/1216/sys/src/9/port/devmouse.c:485,500 | ||
| 1994/0414 | mousexy(void) { return mouse.xy; | |
| 1995/1216 | } void mouseaccelerate(char *x) { if(x == 0) x = "1"; mouse.acceleration = atoi(x); if(mouse.acceleration < 3) mouse.maxacc = 2; else mouse.maxacc = mouse.acceleration; | |
| 1993/1006 | } | |
| 1995/1216/sys/src/9/port/devmouse.c:6,12 – 1996/0223/sys/src/9/port/devmouse.c:6,11 (short | long) | ||
| 1993/1006 | #include "fns.h" #include "../port/error.h" | |
| 1994/0210 | #include "screen.h" | |
| 1993/1006 | typedef struct Mouseinfo Mouseinfo; | |
| 1996/0223/sys/src/9/port/devmouse.c:1,6 – 1997/0201/sys/src/9/port/devmouse.c:1,6 (short | long) | ||
| 1993/1006 | #include "u.h" #include "../port/lib.h" | |
| 1997/0201 | #include <libgb.h> | |
| 1993/1006 | #include "mem.h" #include "dat.h" #include "fns.h" | |
| 1997/0201/sys/src/9/port/devmouse.c:1,6 – 1997/0202/sys/src/9/port/devmouse.c:1,6 (short | long) | ||
| 1993/1006 | #include "u.h" #include "../port/lib.h" | |
| 1997/0201 |
| |
| 1997/0202 | #include <libg.h> | |
| 1993/1006 | #include "mem.h" #include "dat.h" #include "fns.h" | |
| 1997/0202/sys/src/9/port/devmouse.c:1,11 – 1997/0327/sys/src/9/port/devmouse.c:1,11 (short | long) | ||
| 1993/1006 | #include "u.h" #include "../port/lib.h" | |
| 1997/0202 |
| |
| 1993/1006 | #include "mem.h" #include "dat.h" #include "fns.h" #include "../port/error.h" | |
| 1997/0327 | #include <libg.h> | |
| 1994/0210 | #include "screen.h" | |
| 1993/1006 | typedef struct Mouseinfo Mouseinfo; | |
| 1997/0202/sys/src/9/port/devmouse.c:53,58 – 1997/0327/sys/src/9/port/devmouse.c:53,59 | ||
| 1993/1006 | void Cursortocursor(Cursor*); int mousechanged(void*); | |
| 1997/0327 | static void mouseclock(void); | |
| 1993/1006 | enum{ Qdir, | |
| 1997/0202/sys/src/9/port/devmouse.c:67,77 – 1997/0327/sys/src/9/port/devmouse.c:68,76 | ||
| 1993/1006 | "mousectl", {Qmousectl}, 0, 0220, }; | |
| 1994/0413 | extern Bitmap gscreen; | |
| 1993/1006 |
| |
| 1997/0327 | static void | |
| 1993/1006 | mousereset(void) { if(!conf.monitor) | |
| 1997/0202/sys/src/9/port/devmouse.c:79,87 – 1997/0327/sys/src/9/port/devmouse.c:78,87 | ||
| 1993/1006 | ||
| 1993/1009 | curs = arrow; | |
| 1993/1006 | Cursortocursor(&arrow); | |
| 1997/0327 | addclock0link(mouseclock); | |
| 1993/1006 | } | |
| 1997/0327 | static void | |
| 1993/1006 | mouseinit(void) { if(!conf.monitor) | |
| 1997/0202/sys/src/9/port/devmouse.c:90,96 – 1997/0327/sys/src/9/port/devmouse.c:90,96 | ||
| 1993/1006 | cursoron(1); } | |
| 1997/0327 | static Chan* | |
| 1993/1006 | mouseattach(char *spec) { if(!conf.monitor) | |
| 1997/0202/sys/src/9/port/devmouse.c:98,104 – 1997/0327/sys/src/9/port/devmouse.c:98,104 | ||
| 1993/1006 | return devattach('m', spec); } | |
| 1997/0327 | static Chan* | |
| 1993/1006 | mouseclone(Chan *c, Chan *nc) { nc = devclone(c, nc); | |
| 1997/0202/sys/src/9/port/devmouse.c:107,125 – 1997/0327/sys/src/9/port/devmouse.c:107,125 | ||
| 1993/1006 | return nc; } | |
| 1997/0327 | static int | |
| 1993/1006 | mousewalk(Chan *c, char *name) { | |
| 1997/0327 | return devwalk(c, name, mousedir, nelem(mousedir), devgen); | |
| 1993/1006 | } | |
| 1997/0327 | static void | |
| 1993/1006 | mousestat(Chan *c, char *db) { | |
| 1997/0327 | devstat(c, db, mousedir, nelem(mousedir), devgen); | |
| 1993/1006 | } | |
| 1997/0327 | static Chan* | |
| 1993/1006 | mouseopen(Chan *c, int omode) { switch(c->qid.path){ | |
| 1997/0202/sys/src/9/port/devmouse.c:146,152 – 1997/0327/sys/src/9/port/devmouse.c:146,152 | ||
| 1993/1006 | return c; } | |
| 1997/0327 | static void | |
| 1995/0804 | mousecreate(Chan*, char*, int, ulong) | |
| 1993/1006 | { if(!conf.monitor) | |
| 1997/0202/sys/src/9/port/devmouse.c:154,172 – 1997/0327/sys/src/9/port/devmouse.c:154,160 | ||
| 1993/1006 | error(Eperm); } | |
| 1995/0804 |
| |
| 1993/1006 |
| |
| 1995/0804 |
| |
| 1993/1006 |
| |
| 1997/0327 | static void | |
| 1993/1006 | mouseclose(Chan *c) { if(c->qid.path!=CHDIR && (c->flag&COPEN)){ | |
| 1997/0202/sys/src/9/port/devmouse.c:184,190 – 1997/0327/sys/src/9/port/devmouse.c:172,178 | ||
| 1993/1006 | } | |
| 1994/0216 | ||
| 1993/1006 |
| |
| 1997/0327 | static long | |
| 1993/1006 | mouseread(Chan *c, void *va, long n, ulong offset) { | |
| 1993/1008 | char buf[4*12+1]; | |
| 1997/0202/sys/src/9/port/devmouse.c:194,200 – 1997/0327/sys/src/9/port/devmouse.c:182,188 | ||
| 1993/1009 | p = va; switch(c->qid.path){ case CHDIR: | |
| 1993/1006 |
| |
| 1997/0327 | return devdirread(c, va, n, mousedir, nelem(mousedir), devgen); | |
| 1993/1006 | ||
| 1993/1009 | case Qcursor: if(offset != 0) | |
| 1997/0202/sys/src/9/port/devmouse.c:231,243 – 1997/0327/sys/src/9/port/devmouse.c:219,225 | ||
| 1993/1006 | return 0; } | |
| 1995/0108 |
| |
| 1993/1006 |
| |
| 1997/0327 | static long | |
| 1995/0804 | mousewrite(Chan *c, void *va, long n, ulong) | |
| 1993/1006 | { | |
| 1993/1008 | char *p; | |
| 1997/0202/sys/src/9/port/devmouse.c:305,315 – 1997/0327/sys/src/9/port/devmouse.c:287,309 | ||
| 1993/1006 | return -1; | |
| 1995/0108 | } | |
| 1993/1006 |
| |
| 1997/0327 | Dev mousedevtab = { mousereset, mouseinit, mouseattach, mouseclone, mousewalk, mousestat, mouseopen, mousecreate, mouseclose, mouseread, devbread, mousewrite, devbwrite, devremove, devwstat, }; | |
| 1993/1006 | void Cursortocursor(Cursor *c) | |
| 1997/0202/sys/src/9/port/devmouse.c:324,330 – 1997/0327/sys/src/9/port/devmouse.c:318,324 | ||
| 1993/1006 | /* * called by the clock routine to redraw the cursor */ | |
| 1997/0327 | static void | |
| 1993/1006 | mouseclock(void) { if(mouse.track){ | |
| Too many diffs (26 > 25). Stopping. | ||