compositor: pass version in wlr_compositor_create

This allows wlroots to support newer versions of the interface
without breaking the API.
This commit is contained in:
Simon Ser 2022-09-05 15:50:21 +02:00
parent 87e7584dd4
commit 0bb574239d
6 changed files with 9 additions and 7 deletions

View File

@ -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();

View File

@ -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);

View File

@ -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);

View File

@ -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

View File

@ -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);

View File

@ -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;