From 0c93394d726131b1badcdc1d8ca8c8fe8037d85c Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Thu, 2 Feb 2023 15:16:58 +0100 Subject: [PATCH] xwayland: Use wl_output.name for XRandR MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If wl_output provides us with an output name, use that as well. If we have both xdg_output.name and wl_output.name (from version >= 4), prefer the latter. Signed-off-by: Olivier Fourdan # See-also: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/189 Reviewed-by: Michel Dänzer --- hw/xwayland/xwayland-output.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c index f864f5ba5..afc416560 100644 --- a/hw/xwayland/xwayland-output.c +++ b/hw/xwayland/xwayland-output.c @@ -694,11 +694,28 @@ output_handle_scale(void *data, struct wl_output *wl_output, int32_t factor) { } +static void +output_handle_name(void *data, struct wl_output *wl_output, + const char *name) +{ + struct xwl_output *xwl_output = data; + + xwl_output_set_name(xwl_output, name); +} + +static void +output_handle_description(void *data, struct wl_output *wl_output, + const char *description) +{ +} + static const struct wl_output_listener output_listener = { output_handle_geometry, output_handle_mode, output_handle_done, - output_handle_scale + output_handle_scale, + output_handle_name, + output_handle_description, }; static void @@ -738,6 +755,9 @@ xdg_output_handle_name(void *data, struct zxdg_output_v1 *xdg_output, { struct xwl_output *xwl_output = data; + if (wl_output_get_version(xwl_output->output) >= 4) + return; /* wl_output.name is preferred */ + xwl_output_set_name(xwl_output, name); } @@ -804,7 +824,7 @@ xwl_output_create(struct xwl_screen *xwl_screen, uint32_t id, } xwl_output->output = wl_registry_bind(xwl_screen->registry, id, - &wl_output_interface, min(version, 2)); + &wl_output_interface, min(version, 4)); if (!xwl_output->output) { ErrorF("Failed binding wl_output\n"); goto err;