Documentation for <wlr/xcursor.h>

Back to index

Table of contents

struct wlr_xcursor

struct wlr_xcursor {
	unsigned int image_count;
	struct wlr_xcursor_image **images;
	char *name;
	uint32_t total_delay;
};

A cursor.

If the cursor is animated, it may contain more than a single image.

wlr_xcursor_frame()

int wlr_xcursor_frame(​struct wlr_xcursor *cursor, uint32_t time);

Find the frame for a given elapsed time in a cursor animation.

This function converts a timestamp (in ms) to a cursor image index.

struct wlr_xcursor_image

struct wlr_xcursor_image {
	uint32_t width;
	uint32_t height;
	uint32_t hotspot_x;
	uint32_t hotspot_y;
	uint32_t delay;
	uint8_t *buffer;
};

A still cursor image.

The buffer contains pixels layed out in a packed DRM_FORMAT_ARGB8888 format.

struct wlr_xcursor_theme

struct wlr_xcursor_theme {
	unsigned int cursor_count;
	struct wlr_xcursor **cursors;
	char *name;
	int size;
};

Container for an Xcursor theme.

wlr_xcursor_theme_destroy()

void wlr_xcursor_theme_destroy(​struct wlr_xcursor_theme *theme);

Destroy a cursor theme.

This implicitly destroys all child cursors and cursor images.

wlr_xcursor_theme_get_cursor()

struct wlr_xcursor *wlr_xcursor_theme_get_cursor(​struct wlr_xcursor_theme *theme, const char *name);

Obtain a cursor for the specified name (e.g. "left_ptr").

If the cursor could not be found, NULL is returned.

wlr_xcursor_theme_load()

struct wlr_xcursor_theme *wlr_xcursor_theme_load(​const char *name, int size);

Loads the named Xcursor theme.

This is useful if you need cursor images for your compositor to use when a client-side cursor is not available or you wish to override client-side cursors for a particular UI interaction (such as using a grab cursor when moving a window around).

The size is given in pixels.

If a cursor theme with the given name couldn't be loaded, a fallback theme is loaded.

On error, NULL is returned.