From 01ed478c65227ae961d33bc1daf4a64da84f15a6 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Mon, 2 Sep 2019 22:42:17 +0300 Subject: [PATCH] xwayland: add support for xdg-output-unstable-v1 version 3 This adds support for xdg-output-unstable-v1 version 3, added in [1]. This new version deprecates zxdg_output_v1.done and replaces it with wl_output.done. If the version is high enough, there's no need to wait for both an xdg_output.done event and a wl_output.done event -- we only care about wl_output.done. [1]: https://gitlab.freedesktop.org/wayland/wayland-protocols/commit/962dd535372c8e4681374c23d2603cbe06cd7031 Signed-off-by: Simon Ser Reviewed-by: Olivier Fourdan --- configure.ac | 2 +- hw/xwayland/xwayland-output.c | 22 +++++++++++++++++++--- hw/xwayland/xwayland.c | 4 +++- meson.build | 2 +- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index 8b1d3982e..4b71f8559 100644 --- a/configure.ac +++ b/configure.ac @@ -2297,7 +2297,7 @@ AM_CONDITIONAL(XEPHYR, [test "x$KDRIVE" = xyes && test "x$XEPHYR" = xyes]) dnl Xwayland DDX -XWAYLANDMODULES="wayland-client >= 1.3.0 wayland-protocols >= 1.10" +XWAYLANDMODULES="wayland-client >= 1.3.0 wayland-protocols >= 1.18" if test "x$XF86VIDMODE" = xyes; then XWAYLANDMODULES="$XWAYLANDMODULES $VIDMODEPROTO" fi diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c index aa6f37864..e32ba1284 100644 --- a/hw/xwayland/xwayland-output.c +++ b/hw/xwayland/xwayland-output.c @@ -308,9 +308,10 @@ output_handle_done(void *data, struct wl_output *wl_output) xwl_output->wl_output_done = TRUE; /* Apply the changes from wl_output only if both "done" events are received, - * or if xdg-output is not supported. + * if xdg-output is not supported or if xdg-output version is high enough. */ - if (xwl_output->xdg_output_done || !xwl_output->xdg_output) + if (xwl_output->xdg_output_done || !xwl_output->xdg_output || + zxdg_output_v1_get_version(xwl_output->xdg_output) >= 3) apply_output_change(xwl_output); } @@ -352,14 +353,29 @@ xdg_output_handle_done(void *data, struct zxdg_output_v1 *xdg_output) struct xwl_output *xwl_output = data; xwl_output->xdg_output_done = TRUE; - if (xwl_output->wl_output_done) + if (xwl_output->wl_output_done && + zxdg_output_v1_get_version(xdg_output) < 3) apply_output_change(xwl_output); } +static void +xdg_output_handle_name(void *data, struct zxdg_output_v1 *xdg_output, + const char *name) +{ +} + +static void +xdg_output_handle_description(void *data, struct zxdg_output_v1 *xdg_output, + const char *description) +{ +} + static const struct zxdg_output_v1_listener xdg_output_listener = { xdg_output_handle_logical_position, xdg_output_handle_logical_size, xdg_output_handle_done, + xdg_output_handle_name, + xdg_output_handle_description, }; struct xwl_output * diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c index 2475366e0..667748a12 100644 --- a/hw/xwayland/xwayland.c +++ b/hw/xwayland/xwayland.c @@ -807,8 +807,10 @@ registry_global(void *data, struct wl_registry *registry, uint32_t id, xwl_screen->expecting_event++; } else if (strcmp(interface, "zxdg_output_manager_v1") == 0) { + /* We support xdg-output from version 1 to version 3 */ + version = min(version, 3); xwl_screen->xdg_output_manager = - wl_registry_bind(registry, id, &zxdg_output_manager_v1_interface, 1); + wl_registry_bind(registry, id, &zxdg_output_manager_v1_interface, version); xwl_screen_init_xdg_output(xwl_screen); } #ifdef XWL_HAS_GLAMOR diff --git a/meson.build b/meson.build index 00a7e3c86..bd2ed3010 100644 --- a/meson.build +++ b/meson.build @@ -62,7 +62,7 @@ libdrm_req = '>= 2.4.89' libselinux_req = '>= 2.0.86' xext_req = '>= 1.0.99.4' wayland_req = '>= 1.3.0' -wayland_protocols_req = '>= 1.10' +wayland_protocols_req = '>= 1.18' gbm_req = '>= 10.2' xf86dgaproto_req = '>= 2.0.99.1'