xcursor: introduce wlr_xcursor_image_get_buffer()

This makes it so callers no longer need to juggle with raw pixel
pointers anymore, and only need a single wlr_buffer-based codepath.

Additionally, cursors can be unloaded without risking use-after-free.
This commit is contained in:
Simon Ser 2026-01-04 18:24:18 +01:00 committed by Simon Zeni
parent 98733c91b4
commit d7f7b68f49
2 changed files with 31 additions and 3 deletions

View file

@ -56,6 +56,10 @@ struct wlr_xcursor_image {
uint32_t hotspot_y; /* hot-spot y (must be inside image) */
uint32_t delay; /* animation delay to next frame (ms) */
uint8_t *buffer; /* pixel data */
struct {
struct wlr_readonly_data_buffer *readonly_buffer;
} WLR_PRIVATE;
};
/**
@ -119,6 +123,11 @@ struct wlr_xcursor *wlr_xcursor_theme_get_cursor(
*/
int wlr_xcursor_frame(struct wlr_xcursor *cursor, uint32_t time);
/**
* Get a struct wlr_buffer from a cursor image.
*/
struct wlr_buffer *wlr_xcursor_image_get_buffer(struct wlr_xcursor_image *image);
/**
* Get the name of the resize cursor for the given edges.
*/