9 moveto(Mousectl *mc, Point pt)
11 _displaymoveto(mc->display, pt);
16 closemouse(Mousectl *mc)
21 /* postnote(PNPROC, mc->pid, "kill"); */
23 do; while(nbrecv(mc->c, &mc->m) > 0);
25 chanfree(mc->resizec);
30 readmouse(Mousectl *mc)
33 flushimage(mc->display, 1);
34 if(recv(mc->c, &mc->m) < 0){
35 fprint(2, "readmouse: %r\n");
50 threadsetname("mouseproc");
51 memset(&m, 0, sizeof m);
55 if(_displayrdmouse(mc->display, &m, &resized) < 0)
56 threadexits("read error");
58 send(mc->resizec, &one);
61 * mc->m is updated after send so it doesn't have wrong value if we block during send.
62 * This means that programs should receive into mc->Mouse (see readmouse() above) if
63 * they want full synchrony.
70 initmouse(char *file, Image *i)
74 mc = mallocz(sizeof(Mousectl), 1);
76 mc->display = i->display;
77 mc->c = chancreate(sizeof(Mouse), 0);
78 chansetname(mc->c, "mousec");
79 mc->resizec = chancreate(sizeof(int), 2);
80 chansetname(mc->resizec, "resizec");
81 proccreate(_ioproc, mc, 32*1024);
86 setcursor(Mousectl *mc, Cursor *c)
88 _displaycursor(mc->display, c);