Utah Raster Toolkit  9999-git
URT Development version (post-3.1b)
Macros | Functions | Variables
XGetHClrs.c File Reference
#include <X11/X.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xlibint.h>
Include dependency graph for XGetHClrs.c:

Go to the source code of this file.

Macros

#define NEED_REPLIES
 

Functions

static int dummy_handle_x_errors (Display *dpy, XErrorEvent *event)
 
int XAllocColors (Display *dpy, Colormap cmap, XColor *defs, int ndefs, int *statuses)
 

Variables

static int counter
 
static intst
 
static int status
 

Macro Definition Documentation

#define NEED_REPLIES

Definition at line 9 of file XGetHClrs.c.

Function Documentation

static int dummy_handle_x_errors ( Display *  dpy,
XErrorEvent *  event 
)
static

Definition at line 16 of file XGetHClrs.c.

19 {
20  st[counter++] = 0;
21  status = False;
22  return 0;
23 }
static int status
Definition: XGetHClrs.c:14
static int * st
Definition: XGetHClrs.c:13
static int counter
Definition: XGetHClrs.c:12
int XAllocColors ( Display *  dpy,
Colormap  cmap,
XColor *  defs,
int  ndefs,
int statuses 
)

Definition at line 26 of file XGetHClrs.c.

32 {
33  xAllocColorReply rep;
34  register xAllocColorReq *req;
35  int (*function)();
36  int i;
37  Status return_status;
38 
39  XSync(dpy, False);
40 
41  function = XSetErrorHandler( dummy_handle_x_errors );
42  st = statuses;
43 
44  LockDisplay(dpy);
45 
46  for (i = 0; i < ndefs; i++)
47  {
48  GetReq(AllocColor, req);
49 
50  req->cmap = cmap;
51  req->red = defs[i].red;
52  req->green = defs[i].green;
53  req->blue = defs[i].blue;
54  }
55 
56  status = True;
57  for (counter = 0; counter < ndefs; counter++)
58  {
59  statuses[counter] = _XReply(dpy, (xReply *) &rep, 0, xTrue);
60  if (statuses[counter]) {
61  defs[counter].pixel = rep.pixel;
62  defs[counter].red = rep.red;
63  defs[counter].green = rep.green;
64  defs[counter].blue = rep.blue;
65  }
66  else
67  status = False;
68  }
69  return_status = status;
70 
71  UnlockDisplay(dpy);
72  SyncHandle();
73 
74  XSetErrorHandler( function );
75 
76  return(return_status);
77 }
Display * dpy
Definition: getx10.c:94
static int status
Definition: XGetHClrs.c:14
static int * st
Definition: XGetHClrs.c:13
static int counter
Definition: XGetHClrs.c:12
static int dummy_handle_x_errors(Display *dpy, XErrorEvent *event)
Definition: XGetHClrs.c:16
int
Definition: getami.c:848
int i
Definition: rletorla.c:82
rle_pixel ** cmap
Definition: get4d.c:47

Variable Documentation

int counter
static

Definition at line 12 of file XGetHClrs.c.

int* st
static

Definition at line 13 of file XGetHClrs.c.

int status
static

Definition at line 14 of file XGetHClrs.c.