types/wlr_xdg_output_v1: Fix wl_output.done bug.

If the client binds to version 3 of zxdg_output_v1 and version 1 of
wl_output no wl_output.done or zxdg_output_v1.done event is
emitted [1].

Also no wl_output.done event is emitted when version 2 or lower of
zxdg_output_v1 is bound to.

Add a version check to output_manager_handle_get_xdg_output so that no
wl_output.done event is emitted when using version 1 of wl_output and
version 2 or lower of zxdg_output_v1.

[1]: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/issues/81
This commit is contained in:
Mark Bolhuis 2022-08-13 22:59:11 +02:00 committed by Simon Ser
parent 346e524201
commit 9ab819684d

View file

@ -127,11 +127,11 @@ static void output_manager_handle_get_xdg_output(struct wl_client *client,
wl_resource_get_link(xdg_output_resource));
// Name and description should only be sent once per output
uint32_t version = wl_resource_get_version(xdg_output_resource);
if (version >= ZXDG_OUTPUT_V1_NAME_SINCE_VERSION) {
uint32_t xdg_version = wl_resource_get_version(xdg_output_resource);
if (xdg_version >= ZXDG_OUTPUT_V1_NAME_SINCE_VERSION) {
zxdg_output_v1_send_name(xdg_output_resource, output->name);
}
if (version >= ZXDG_OUTPUT_V1_DESCRIPTION_SINCE_VERSION &&
if (xdg_version >= ZXDG_OUTPUT_V1_DESCRIPTION_SINCE_VERSION &&
output->description != NULL) {
zxdg_output_v1_send_description(xdg_output_resource,
output->description);
@ -139,7 +139,11 @@ static void output_manager_handle_get_xdg_output(struct wl_client *client,
output_send_details(xdg_output, xdg_output_resource);
uint32_t wl_version = wl_resource_get_version(output_resource);
if (wl_version >= WL_OUTPUT_DONE_SINCE_VERSION &&
xdg_version >= OUTPUT_DONE_DEPRECATED_SINCE_VERSION) {
wl_output_send_done(output_resource);
}
}
static const struct zxdg_output_manager_v1_interface