aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/wlr/types/wlr_compositor.h7
-rw-r--r--types/wlr_compositor.c12
2 files changed, 15 insertions, 4 deletions
diff --git a/include/wlr/types/wlr_compositor.h b/include/wlr/types/wlr_compositor.h
index 441a6bb5..5a6755c7 100644
--- a/include/wlr/types/wlr_compositor.h
+++ b/include/wlr/types/wlr_compositor.h
@@ -90,7 +90,7 @@ struct wlr_surface_output {
struct wlr_surface {
struct wl_resource *resource;
- struct wlr_renderer *renderer;
+ struct wlr_renderer *renderer; // may be NULL
/**
* The surface's buffer, if any. A surface has an attached buffer when it
* commits with a non-null buffer in its pending state. A surface will not
@@ -168,7 +168,7 @@ struct wlr_renderer;
struct wlr_compositor {
struct wl_global *global;
- struct wlr_renderer *renderer;
+ struct wlr_renderer *renderer; // may be NULL
struct wl_listener display_destroy;
@@ -305,6 +305,9 @@ void wlr_surface_unlock_cached(struct wlr_surface *surface, uint32_t seq);
/**
* Create the wl_compositor global, which can be used by clients to create
* surfaces and regions.
+ *
+ * If a renderer is supplied, the compositor will create struct wlr_texture
+ * objects from client buffers on surface commit.
*/
struct wlr_compositor *wlr_compositor_create(struct wl_display *display,
struct wlr_renderer *renderer);
diff --git a/types/wlr_compositor.c b/types/wlr_compositor.c
index 1f85e4ae..996a046d 100644
--- a/types/wlr_compositor.c
+++ b/types/wlr_compositor.c
@@ -370,6 +370,10 @@ static void surface_apply_damage(struct wlr_surface *surface) {
}
}
+ if (surface->renderer == NULL) {
+ return;
+ }
+
struct wlr_client_buffer *buffer = wlr_client_buffer_create(
surface->current.buffer, surface->renderer);
@@ -699,8 +703,12 @@ static struct wlr_surface *surface_create(struct wl_client *client,
pixman_region32_init(&surface->input_region);
wlr_addon_set_init(&surface->addons);
- wl_signal_add(&renderer->events.destroy, &surface->renderer_destroy);
- surface->renderer_destroy.notify = surface_handle_renderer_destroy;
+ if (renderer != NULL) {
+ wl_signal_add(&renderer->events.destroy, &surface->renderer_destroy);
+ surface->renderer_destroy.notify = surface_handle_renderer_destroy;
+ } else {
+ wl_list_init(&surface->renderer_destroy.link);
+ }
return surface;
}