diff --git a/examples/fullscreen-shell.c b/examples/fullscreen-shell.c index cba5a4cb0..ff8f60c1c 100644 --- a/examples/fullscreen-shell.c +++ b/examples/fullscreen-shell.c @@ -211,7 +211,7 @@ int main(int argc, char *argv[]) { server.allocator = wlr_allocator_autocreate(server.backend, server.renderer); - wlr_compositor_create(server.wl_display, server.renderer); + wlr_compositor_create(server.wl_display, 5, server.renderer); server.output_layout = wlr_output_layout_create(); diff --git a/examples/output-layers.c b/examples/output-layers.c index 2ccfafe11..69c97b11a 100644 --- a/examples/output-layers.c +++ b/examples/output-layers.c @@ -292,7 +292,7 @@ int main(int argc, char *argv[]) { server.renderer); struct wlr_compositor *compositor = - wlr_compositor_create(server.wl_display, server.renderer); + wlr_compositor_create(server.wl_display, 5, server.renderer); wlr_xdg_shell_create(server.wl_display, 1); diff --git a/examples/scene-graph.c b/examples/scene-graph.c index 5821c9064..3d75164bd 100644 --- a/examples/scene-graph.c +++ b/examples/scene-graph.c @@ -167,7 +167,7 @@ int main(int argc, char *argv[]) { server.renderer); struct wlr_compositor *compositor = - wlr_compositor_create(server.display, server.renderer); + wlr_compositor_create(server.display, 5, server.renderer); wlr_xdg_shell_create(server.display, 2); diff --git a/include/wlr/types/wlr_compositor.h b/include/wlr/types/wlr_compositor.h index 75d6605fb..70b219d8e 100644 --- a/include/wlr/types/wlr_compositor.h +++ b/include/wlr/types/wlr_compositor.h @@ -327,6 +327,6 @@ void wlr_surface_unlock_cached(struct wlr_surface *surface, uint32_t seq); * objects from client buffers on surface commit. */ struct wlr_compositor *wlr_compositor_create(struct wl_display *display, - struct wlr_renderer *renderer); + uint32_t version, struct wlr_renderer *renderer); #endif diff --git a/tinywl/tinywl.c b/tinywl/tinywl.c index d490167dd..5ed941814 100644 --- a/tinywl/tinywl.c +++ b/tinywl/tinywl.c @@ -879,7 +879,7 @@ int main(int argc, char *argv[]) { * to dig your fingers in and play with their behavior if you want. Note that * the clients cannot set the selection directly without compositor approval, * see the handling of the request_set_selection event below.*/ - wlr_compositor_create(server.wl_display, server.renderer); + wlr_compositor_create(server.wl_display, 5, server.renderer); wlr_subcompositor_create(server.wl_display); wlr_data_device_manager_create(server.wl_display); diff --git a/types/wlr_compositor.c b/types/wlr_compositor.c index 6a882a0ac..812dd2204 100644 --- a/types/wlr_compositor.c +++ b/types/wlr_compositor.c @@ -1146,14 +1146,16 @@ static void compositor_handle_display_destroy( } struct wlr_compositor *wlr_compositor_create(struct wl_display *display, - struct wlr_renderer *renderer) { + uint32_t version, struct wlr_renderer *renderer) { + assert(version <= COMPOSITOR_VERSION); + struct wlr_compositor *compositor = calloc(1, sizeof(*compositor)); if (!compositor) { return NULL; } compositor->global = wl_global_create(display, &wl_compositor_interface, - COMPOSITOR_VERSION, compositor, compositor_bind); + version, compositor, compositor_bind); if (!compositor->global) { free(compositor); return NULL;