From 9ab819684d41b5052260e11a337ce0cdee6ce3bd Mon Sep 17 00:00:00 2001 From: Mark Bolhuis Date: Sat, 13 Aug 2022 22:59:11 +0200 Subject: [PATCH] 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 --- types/wlr_xdg_output_v1.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/types/wlr_xdg_output_v1.c b/types/wlr_xdg_output_v1.c index 062bf6e6..d030748d 100644 --- a/types/wlr_xdg_output_v1.c +++ b/types/wlr_xdg_output_v1.c @@ -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); - wl_output_send_done(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