|
|
1.1 root 1: #include "copyright.h"
2:
3: /* $Header: XLookupCol.c,v 11.6 87/09/11 08:10:04 toddb Exp $ */
4: /* Copyright Massachusetts Institute of Technology 1985 */
5:
6: #define NEED_REPLIES
7: #include "Xlibint.h"
8:
9: Status XLookupColor (dpy, cmap, spec, def, scr)
10: register Display *dpy;
11: Colormap cmap;
12: register char *spec;
13: XColor *def, *scr;
14: {
15: register int n;
16: xLookupColorReply reply;
17: register xLookupColorReq *req;
18:
19: n = strlen (spec);
20: LockDisplay(dpy);
21: GetReq (LookupColor, req);
22: req->cmap = cmap;
23: req->nbytes = n;
24: req->length += (n + 3) >> 2;
25: Data (dpy, spec, (long)n);
26: if (!_XReply (dpy, (xReply *) &reply, 0, xTrue)) {
27: UnlockDisplay(dpy);
28: SyncHandle();
29: return (0);
30: }
31: def->red = reply.exactRed;
32: def->green = reply.exactGreen;
33: def->blue = reply.exactBlue;
34:
35: scr->red = reply.screenRed;
36: scr->green = reply.screenGreen;
37: scr->blue = reply.screenBlue;
38:
39: UnlockDisplay(dpy);
40: SyncHandle();
41: return (1);
42: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.