Skip to content

Draft: Vector cursors

Tag Howard requested to merge tajetaje/libxcursor:vector-cursors into master

This branch reflects a proposed update to the Xcursor format that enables SVG files to be shipped as part of cursor themes.

The general idea is to add a new chunk type, Vector, which contains a path to an SVG file shipped alongside the files in the cursors directory.

The format of the chunk is basically a comment chunk with the addition of a hotspot x/y and delay. The hotspot coordinates are fixed point decimals stored as unsigned 32-bit integers. The path itself is stored and formatted identically to the existing comment chunk.

ChunkHeader	header	chunk header
CARD32          length  byte length of UTF-8 path
CARD32	        xhot	hot spot x (converted to a float with xhot/1000000.0)
CARD32	        yhot	hot spot y (converted to a float with yhot/1000000.0)
CARD32	        delay	animation delay
LISTofCARD8     path	Slash separated UTF-8 encoded relative path

Most of the libXursor source API was unchanged, but those methods that produce a Cursor type were changed to support rendering an SVG to a Cursor using a callback.

As I mentioned over on Plasma Breeze Style #20

I have successfully tested that format with Breeze icons using my fork of libxcursor, xcursorgen, and xcursor-viewer. I have obviously only tested the codepaths that are actually used by these tools, but it all seems to work well enough for a prototype. Looking at the entirety of the libxcursor codebase the only real pain point will be the APIs that load and render a Cursor, for example Cursor XcursorLibraryLoadCursor (Display *dpy, const char *name), but I'm guessing those aren't very relevant at this point.

I'm not necessarily expecting this to be merged, but I did some tinkering around with this idea and think it's a good enough one to share.

This branch is not in a fit state for merging as there are still some open questions about design and I believe the commits themselves do not match FreeDesktop standards. Plus the man pages will need updating

Edited by Tag Howard

Merge request reports

Loading