summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Fourdan <ofourdan@redhat.com>2023-02-02 15:16:58 +0100
committerOlivier Fourdan <ofourdan@redhat.com>2023-02-13 14:41:05 +0100
commit0c93394d726131b1badcdc1d8ca8c8fe8037d85c (patch)
treec3395ca8a7d2f2760633e5fcf694662b9f234235
parentb63ef10f188936506e8050015d3654aa324f6e43 (diff)
downloadxserver-0c93394d726131b1badcdc1d8ca8c8fe8037d85c.tar.gz
xwayland: Use wl_output.name for XRandR
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 <ofourdan@redhat.com># See-also: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/189 Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
-rw-r--r--hw/xwayland/xwayland-output.c24
1 files 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;