9 #include "x11-memdraw.h"
12 moveto(Mousectl *m, Point pt)
18 closemouse(Mousectl *mc)
23 /* postnote(PNPROC, mc->pid, "kill");
25 do; while(nbrecv(mc->c, &mc->m) > 0);
30 chanfree(mc->resizec);
35 readmouse(Mousectl *mc)
38 flushimage(mc->display, 1);
39 if(recv(mc->c, &mc->m) < 0){
40 fprint(2, "readmouse: %r\n");
58 threadsetname("mouseproc");
59 memset(&m, 0, sizeof m);
61 mask = MouseMask|ExposureMask|StructureNotifyMask;
62 XSelectInput(_x.mousecon, _x.drawable, mask);
64 XNextEvent(_x.mousecon, &xevent);
67 xexpose(&xevent, _x.mousecon);
70 if(xconfigure(&xevent, _x.mousecon))
71 nbsend(mc->resizec, &one);
73 case SelectionRequest:
74 xselect(&xevent, _x.mousecon);
79 if(xtoplan9mouse(&xevent, &m) < 0)
83 * mc->Mouse is updated after send so it doesn't have wrong value if we block during send.
84 * This means that programs should receive into mc->Mouse (see readmouse() above) if
85 * they want full synchrony.
94 initmouse(char *file, Image *i)
98 mc = mallocz(sizeof(Mousectl), 1);
100 mc->display = i->display;
101 mc->c = chancreate(sizeof(Mouse), 0);
102 mc->resizec = chancreate(sizeof(int), 2);
103 proccreate(_ioproc, mc, 16384);
108 setcursor(Mousectl *mc, Cursor *c)