Xcursor
More info
- Creator
- Keith Packard
- Released
- Type
- Library and file format
- Source
- gitlab.freedesktop.org
The library that gave X11 mouse pointers in colour, with shadows and animation, loaded from themes on disk instead of from a black-and-white font.
The core protocol builds a pointer from a pair of glyphs in a special font: a shape and a mask, one bit per pixel, with black and white as the only colours. Keith Packard wrote Xcursor in 2002 and it shipped with XFree86 4.3 the following year. The library sits in front of the old call: when a program asks for the pointer left_ptr, Xcursor searches the theme directories under ~/.icons and /usr/share/icons for a file of that name, and only if nothing turns up does it fall back to the font. One file can hold the same pointer at several sizes and as a series of frames with delays, which is how the spinning busy pointer is made. Colours with an alpha channel need RENDER in the server.
The theme is chosen with XCURSOR_THEME and the size with XCURSOR_SIZE, and a theme can inherit from another through index.theme, so one that only draws the arrow gets the rest from Adwaita. A pointer that changes appearance between the desktop and one particular program is almost always a program that never saw the theme, typically one running as root. Wayland took the whole format with it: libwayland-cursor reads the same files, and only in 2023 did a protocol arrive in which the client says "give me an arrow" instead of loading the image itself.