XSetRGBColormaps

Syntax

void XSetRGBColormaps(display, w, std_colormap, count, property)
      Display *display;
      Window w;
      XStandardColormap *std_colormap;
      int count;
      Atom property;

Arguments

display Specifies the connection to the X server.
w Specifies the window.
std_colormap Specifies the XStandardColormap structure to be used.
count Specifies the number of colormaps.
property Specifies the property name.

Description

The XSetRGBColormaps() function replaces the RGB colormap definition in the specified property on the named window. If the property does not already exist, XSetRGBColormaps() sets the RGB colormap definition in the specified property on the named window. The property is stored with a type of RGB_COLOR_MAP and a format of 32. Note that it is the caller's responsibility to honor the ICCCM restriction that only RGB_DEFAULT_MAP contain more than one definition.

The XSetRGBColormaps() function usually is only used by window or session managers. To create a standard colormap, follow this procedure:

  1. Open a new connection to the same server.

  2. Grab the server.

  3. See if the property is on the property list of the root window for the screen.

  4. If the desired property is not present:
    • Create a colormap (unless you are using the default colormap of the screen).
    • Determine the color characteristics of the visual.
    • Allocate cells in the colormap (or create it with AllocAll).
    • Call XStoreColors() to store appropriate color values in the colormap.
    • Fill in the descriptive members in the XStandardColormap structure.
    • Attach the property to the root window.
    • Use XSetCloseDownMode() to make the resource permanent.

  5. Ungrab the server.

    XSetRGBColormaps() can generate BadAlloc, BadAtom, and BadWindow errors.

    Diagnostics

    BadAlloc The server failed to allocate the requested source or server memory.
    BadAtom A value for an Atom argument does not name a defined Atom.
    BadWindow A value for a Window argument does not name a defined Window.

    See also

    XAllocStandardColormap(), XGetRGBColormaps(), XStandardColormap, XAllocColor(), XCreateColormap(), XFree(), XSetCloseDownMode(), "Setting and Obtaining Standard Colormaps".
    Christophe Tronche, [email protected]