File:  [CSRG BSD Unix] / 43BSDTahoe / new / X / Xlib / XQueryColors.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 16:12:58 2018 UTC (8 years, 1 month ago) by root
Branches: MAIN, BSD
CVS tags: HEAD, BSD43tahoe
BSD 4.3tahoe

#include <X/mit-copyright.h>

/* $Header: /var/lib/cvsd/repos/CSRG/43BSDTahoe/new/X/Xlib/XQueryColors.c,v 1.1.1.1 2018/04/24 16:12:58 root Exp $ */
/* Copyright    Massachusetts Institute of Technology    1985	*/

#include "XlibInternal.h"
#define MAXREQS 80  /* to prevent deadlock due to full TCP buffers */

XQueryColors (colors, ncolors)
    	Color colors[];
	int ncolors;
{
	register Display *dpy;
	register XReq *req;
	register int i;
	register Color *color = colors;
	XRep rep;

	while (ncolors > 0) {
	    register int nreqs = (ncolors > MAXREQS) ? MAXREQS : ncolors;
	    for (i=0;i<nreqs;i++) {
	     	GetReq (X_QueryColor, 0);
	     	req->paramu0 = (color++)->pixel;
	     	}

	    /* Reset request number, so error packets are handled correctly */
	    dpy->request -= nreqs;
	    color -= nreqs;

	    for (i=0;i<nreqs;i++) {
	     	/* Increment request number, so error packets are handled
	    	    correctly */
	     	dpy->request++;
	     	_XReply (dpy, &rep);
	     	color->red = rep.paramu0;
	     	color->green = rep.paramu1;
	     	(color++)->blue = rep.paramu2;
	    	}
	    
	    ncolors -= nreqs;
	    }
}


unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.