module/foreign-toplevel: require version 3 of wl-output interface

The bar itself already does this, and doing so means we can always use
wl_output_release() (instead of wl_output_destroy()).
This commit is contained in:
Daniel Eklöf 2021-08-25 09:46:23 +02:00
parent 589a6f528a
commit 9681e0aabe
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -29,7 +29,6 @@ struct output {
struct zxdg_output_v1 *xdg_output;
char *name;
bool use_output_release;
};
struct toplevel {
@ -64,12 +63,8 @@ output_free(struct output *output)
free(output->name);
if (output->xdg_output != NULL)
zxdg_output_v1_destroy(output->xdg_output);
if (output->wl_output != NULL) {
if (output->use_output_release)
if (output->wl_output != NULL)
wl_output_release(output->wl_output);
else
wl_output_destroy(output->wl_output);
}
}
static void
@ -468,7 +463,7 @@ handle_global(void *data, struct wl_registry *registry,
}
else if (strcmp(interface, wl_output_interface.name) == 0) {
const uint32_t required = 1;
const uint32_t required = 3;
if (!verify_iface_version(interface, version, required))
return;
@ -476,9 +471,7 @@ handle_global(void *data, struct wl_registry *registry,
.mod = mod,
.wl_name = name,
.wl_output = wl_registry_bind(
registry, name,
&wl_output_interface, min(version, WL_OUTPUT_RELEASE_SINCE_VERSION)),
.use_output_release = version >= WL_OUTPUT_RELEASE_SINCE_VERSION,
registry, name, &wl_output_interface, required),
};
mtx_lock(&mod->lock);