From a9458c5bc75cb6b6581cb77b3c5145281a351688 Mon Sep 17 00:00:00 2001 From: Alexander Orzechowski Date: Thu, 11 Apr 2024 14:30:22 -0400 Subject: [PATCH] wlr_cursor_set_surface: Use wlr_raster to generate texture from surface Since wlr_raster supports wlr_compositor usage with and without a renderer, use it for wlr_curosr so cursors support running on a surface without a renderer. --- types/wlr_cursor.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/types/wlr_cursor.c b/types/wlr_cursor.c index a2489fbd1..d85893afc 100644 --- a/types/wlr_cursor.c +++ b/types/wlr_cursor.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -539,7 +540,13 @@ static void cursor_output_cursor_update(struct wlr_cursor_output_cursor *output_ } else if (cur->state->surface != NULL) { struct wlr_surface *surface = cur->state->surface; - struct wlr_texture *texture = wlr_surface_get_texture(surface); + struct wlr_texture *texture = NULL; + struct wlr_raster *raster = wlr_raster_from_surface(surface); + if (raster) { + texture = wlr_raster_obtain_texture(raster, output_cursor->output_cursor->output->renderer); + } + wlr_raster_unlock(raster); + int32_t hotspot_x = cur->state->surface_hotspot.x; int32_t hotspot_y = cur->state->surface_hotspot.y;