| XCURSOR(3) | Library Functions Manual | XCURSOR(3) | 
#include <X11/Xcursor/Xcursor.h>
Cursor files are stored as a header containing a table of contents followed by a sequence of chunks. The table of contents indicates the type, subtype and position in the file of each chunk. The file header looks like:
  
  magic: CARD32 'Xcur' (0x58, 0x63, 0x75, 0x72)
  
  header: CARD32 bytes in this header
  
  version: CARD32 file version number
  
  ntoc: CARD32 number of toc entries
  
  toc: LISTofTOC table of contents
  
Each table of contents entry looks like:
  
  type: CARD32 entry type
  
  subtype: CARD32 type-specific label - size for images
  
  position: CARD32 absolute byte position of table in file
  
Each chunk in the file has set of common header fields followed by additional type-specific fields:
  
  header: CARD32 bytes in chunk header (including type-specific fields)
  
  type: CARD32 must match type in TOC for this chunk
  
  subtype: CARD32 must match subtype in TOC for this chunk
  
  version: CARD32 version number for this chunk type
  
There are currently two chunk types defined for cursor files; comments and images. Comments look like:
  
  header: 20 Comment headers are 20 bytes
  
  type: 0xfffe0001 Comment type is 0xfffe0001
  
  subtype: { 1 (COPYRIGHT), 2 (LICENSE), 3 (OTHER) }
  
  version: 1
  
  length: CARD32 byte length of UTF-8 string
  
  string: LISTofCARD8 UTF-8 string
  
Images look like:
  
  header: 36 Image headers are 36 bytes
  
  type: 0xfffd0002 Image type is 0xfffd0002
  
  subtype: CARD32 Image subtype is the nominal size
  
  version: 1
  
  width: CARD32 Must be less than or equal to 0x7fff
  
  height: CARD32 Must be less than or equal to 0x7fff
  
  xhot: CARD32 Must be less than or equal to width
  
  yhot: CARD32 Must be less than or equal to height
  
  delay: CARD32 Delay between animation frames in milliseconds
  
  pixels: LISTofCARD32 Packed ARGB format pixels
  
If necessary, Xcursor also looks for a "index.theme" file in each theme directory to find inherited themes and searches along the path for those themes as well.
If no theme is set, or if no cursor is found for the specified theme, Xcursor checks the "default" theme.
typedef struct _XcursorImage { XcursorDim size; /∗ nominal size for matching */ XcursorDim width; /∗ actual width */ XcursorDim height; /∗ actual height */ XcursorDim xhot; /∗ hot spot x (must be inside image) */ XcursorDim yhot; /∗ hot spot y (must be inside image) */ XcursorPixel *pixels; /∗ pointer to pixels */ } XcursorImage;
typedef struct _XcursorImages { int nimage; /∗ number of images */ XcursorImage **images; /∗ array of XcursorImage pointers */ } XcursorImages;
typedef struct _XcursorCursors { Display *dpy; /∗ Display holding cursors */ int ref; /∗ reference count */ int ncursor; /∗ number of cursors */ Cursor *cursors; /∗ array of cursors */ } XcursorCursors;
typedef struct _XcursorAnimate { XcursorCursors *cursors; /∗ list of cursors to use */ int sequence; /∗ which cursor is next */ } XcursorAnimate;
typedef struct _XcursorFile { void *closure; int (*read) (XcursorFile *file, unsigned char *buf, int len); int (*write) (XcursorFile *file, unsigned char *buf, int len); int (*seek) (XcursorFile *file, long offset, int whence); };
| X Version 11 | Keith Packard |