From 6d6e70b9e0e40b6d38ba9276127b869bae893d43 Mon Sep 17 00:00:00 2001 From: Simon Zeni Date: Fri, 24 Sep 2021 09:34:51 -0400 Subject: examples: init wlr_output with allocator and renderer --- examples/quads.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'examples/quads.c') diff --git a/examples/quads.c b/examples/quads.c index 6696ef7c..d74ef25e 100644 --- a/examples/quads.c +++ b/examples/quads.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -24,6 +25,7 @@ struct sample_state { struct wl_listener new_input; struct timespec last_frame; struct wlr_renderer *renderer; + struct wlr_allocator *allocator; struct wl_list outputs; }; @@ -103,6 +105,9 @@ static void output_remove_notify(struct wl_listener *listener, void *data) { static void new_output_notify(struct wl_listener *listener, void *data) { struct wlr_output *output = data; struct sample_state *sample = wl_container_of(listener, sample, new_output); + + wlr_output_init_render(output, sample->allocator, sample->renderer); + struct sample_output *sample_output = calloc(1, sizeof(struct sample_output)); struct wlr_output_mode *mode = wlr_output_preferred_mode(output); @@ -195,13 +200,15 @@ int main(int argc, char *argv[]) { state.new_input.notify = new_input_notify; clock_gettime(CLOCK_MONOTONIC, &state.last_frame); - state.renderer = wlr_backend_get_renderer(wlr); + state.renderer = wlr_renderer_autocreate(wlr); if (!state.renderer) { wlr_log(WLR_ERROR, "Could not start compositor, OOM"); wlr_backend_destroy(wlr); exit(EXIT_FAILURE); } + state.allocator = wlr_allocator_autocreate(wlr, state.renderer); + if (!wlr_backend_start(wlr)) { wlr_log(WLR_ERROR, "Failed to start backend"); wlr_backend_destroy(wlr); -- cgit v1.2.3