From 17cdf9b4ebac4167d510bcb44b3c22044e254380 Mon Sep 17 00:00:00 2001 From: Alexander Orzechowski Date: Sat, 14 Sep 2024 18:42:40 -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 | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/types/wlr_cursor.c b/types/wlr_cursor.c index a2489fbd1..9b00e386e 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,12 @@ 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); + } + int32_t hotspot_x = cur->state->surface_hotspot.x; int32_t hotspot_y = cur->state->surface_hotspot.y; @@ -561,12 +567,14 @@ static void cursor_output_cursor_update(struct wlr_cursor_output_cursor *output_ &src_box, dst_width, dst_height, surface->current.transform, hotspot_x, hotspot_y, wait_timeline, wait_point); - if (syncobj_surface_state != NULL && surface->buffer != NULL && + if (syncobj_surface_state != NULL && raster && raster->buffer != NULL && (surface->current.committed & WLR_SURFACE_STATE_BUFFER)) { wlr_linux_drm_syncobj_v1_state_signal_release_with_buffer(syncobj_surface_state, - &surface->buffer->base); + raster->buffer); } + wlr_raster_unlock(raster); + if (output_cursor->output_cursor->visible) { wlr_surface_send_enter(surface, output); } else {