Skip to main content

Requests: Cursors

CreateCursor​

cid: CURSOR
source: PIXMAP
mask: PIXMAP or None
fore-red, fore-green, fore-blue: CARD16
back-red, back-green, back-blue: CARD16
x, y: CARD16
Errors: IDChoice, Bitmap, Match, Value, Alloc

Creates a cursor and associates identifier cid with it. Foreground and background RGB values must be specified, even if the server only has a monochrome screen. The foreground is used for the one bits in the source, and the background is used for the zero bits. Both source and mask (if specified) must have depth one (else a Match error), but can have any root. The mask pixmap defines the shape of the cursor; that is, the one bits in the mask define which source pixels will be displayed. If no mask is given, all pixels of the source are displayed. The mask, if present, must be the same size as source (else a Match error). The x and y coordinates define the hotspot, relative to the source's origin, and must be a point within the source (else a Match error).

The components of the cursor may 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 server might or might not make a copy of the pixmap.

CreateGlyphCursor​

cid: CURSOR
source-font: FONT
mask-font: FONT or None
source-char, mask-char: CARD16
fore-red, fore-green, fore-blue: CARD16
back-red, back-green, back-blue: CARD16
Errors: IDChoice, Font, Value, Alloc

Similar to CreateCursor, but the source and mask bitmaps are obtained from the specified font glyphs. The mask font and character are optional. The origin of the source glyph defines the hotspot, and the mask is positioned such that the origins are coincident. The source and mask need not have the same bounding box metrics. If no mask is given, all pixels of the source are displayed. Note that source-char and mask-char are CARD16 (not CHAR2B); for two-byte matrix fonts, the 16-bit value should be formed with byte1 in the most significant byte and byte2 in the least significant byte.

FreeCursor​

cursor: CURSOR
Errors: Cursor

Deletes the association between the resource id and the cursor. The cursor storage will be freed when no other resource references it.

RecolorCursor​

cursor: CURSOR
fore-red, fore-green, fore-blue: CARD16
back-red, back-green, back-blue: CARD16
Errors: Cursor

Changes the color of a cursor. If the cursor is being displayed on a screen, the change is visible immediately.