From b63ef10f188936506e8050015d3654aa324f6e43 Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Tue, 7 Feb 2023 15:05:34 +0100 Subject: xwayland: Pass the wl_output version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With the wl_output protocol, the actual bind to the interface is done in xwl_output_create(). Pass the version number from the registry so we can bind to the minimum version. Signed-off-by: Olivier Fourdan Reviewed-by: Michel Dänzer --- hw/xwayland/xwayland-output.c | 5 +++-- hw/xwayland/xwayland-output.h | 3 ++- hw/xwayland/xwayland-screen.c | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c index 8e387e760..f864f5ba5 100644 --- a/hw/xwayland/xwayland-output.c +++ b/hw/xwayland/xwayland-output.c @@ -791,7 +791,8 @@ xwl_output_from_wl_output(struct xwl_screen *xwl_screen, } struct xwl_output * -xwl_output_create(struct xwl_screen *xwl_screen, uint32_t id, Bool with_xrandr) +xwl_output_create(struct xwl_screen *xwl_screen, uint32_t id, + Bool with_xrandr, uint32_t version) { struct xwl_output *xwl_output; char name[MAX_OUTPUT_NAME]; @@ -803,7 +804,7 @@ xwl_output_create(struct xwl_screen *xwl_screen, uint32_t id, Bool with_xrandr) } xwl_output->output = wl_registry_bind(xwl_screen->registry, id, - &wl_output_interface, 2); + &wl_output_interface, min(version, 2)); if (!xwl_output->output) { ErrorF("Failed binding wl_output\n"); goto err; diff --git a/hw/xwayland/xwayland-output.h b/hw/xwayland/xwayland-output.h index e975dfbf6..a95288e4f 100644 --- a/hw/xwayland/xwayland-output.h +++ b/hw/xwayland/xwayland-output.h @@ -84,7 +84,8 @@ struct xwl_output *xwl_output_from_wl_output(struct xwl_screen *xwl_screen, struct wl_output* wl_output); struct xwl_output *xwl_output_create(struct xwl_screen *xwl_screen, - uint32_t id, Bool with_xrandr); + uint32_t id, Bool with_xrandr, + uint32_t version); void xwl_output_destroy(struct xwl_output *xwl_output); diff --git a/hw/xwayland/xwayland-screen.c b/hw/xwayland/xwayland-screen.c index 94085af34..46ab4fed7 100644 --- a/hw/xwayland/xwayland-screen.c +++ b/hw/xwayland/xwayland-screen.c @@ -432,7 +432,7 @@ registry_global(void *data, struct wl_registry *registry, uint32_t id, NULL); } else if (strcmp(interface, "wl_output") == 0 && version >= 2) { - if (xwl_output_create(xwl_screen, id, (xwl_screen->fixed_output == NULL))) + if (xwl_output_create(xwl_screen, id, (xwl_screen->fixed_output == NULL), version)) xwl_screen->expecting_event++; } else if (strcmp(interface, "zxdg_output_manager_v1") == 0) { -- cgit v1.2.1