Cursor XCreatePixmapCursor(display, source, mask, foreground_color, background_color, x, y)
      Display *display;
      Pixmap source;
      Pixmap mask;
      XColor *foreground_color;
      XColor *background_color;
      unsigned int x, y;


display Specifies the connection to the X server.
source Specifies the shape of the source cursor.
mask Specifies the cursor's source bits to be displayed or None .
foreground_color Specifies the RGB values for the foreground of the source.
background_color Specifies the RGB values for the background of the source. .ds Xy
y Specify the x and y coordinates, which indicate the hotspot relative to the source's origin.


The XCreatePixmapCursor() function creates a cursor and returns the cursor ID associated with it. The foreground and background RGB values must be specified using foreground_color and background_color, even if the X server only has a StaticGray or GrayScale screen. The foreground color is used for the pixels set to 1 in the source, and the background color is used for the pixels set to 0. Both source and mask, if specified, must have depth one (or a BadMatch error results) but can have any root. The mask argument defines the shape of the cursor. The pixels set to 1 in the mask define which source pixels are displayed, and the pixels set to 0 define which pixels are ignored. If no mask is given, all pixels of the source are displayed. The mask, if present, must be the same size as the pixmap defined by the source argument, or a BadMatch error results. The hotspot must be a point within the source, or a BadMatch error results.

The components of the cursor can be transformed arbitrarily to meet display limitations. The pixmaps can be freed immediately if no further explicit references to them are to be made. Subsequent drawing in the source or mask pixmap has an undefined effect on the cursor. The X server might or might not make a copy of the pixmap.

XCreatePixmapCursor() can generate BadAlloc and BadPixmap errors.


BadAlloc The server failed to allocate the requested source or server memory.
BadPixmap A value for a Pixmap argument does not name a defined Pixmap.

See also

XCreateFontCursor(), XCreateGlyphCursor(), XDefineCursor(), XLoadFont(), XRecolorCursor(), "Creating, Recoloring, and Freeing Cursors".
Christophe Tronche, [email protected]