| plan 9 kernel history: overview | file list | diff list |
1994/0413/port/devmouse.c (diff list | history)
| 1994/0412/sys/src/9/port/devmouse.c:1,7 – 1994/0413/sys/src/9/port/devmouse.c:1,6 (short | long | prev | next) | ||
| 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); } | |