From f0124485e10848a8b6e8e5834bef2c2da3fb8e37 Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Mon, 4 Dec 2023 16:12:08 +0100 Subject: [PATCH] xwayland: Use the output serial for the fixed output MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The fixed output is called "XWAYLAND0", yet if the compositor does not support Wayland output names, the "real" output names may collide with the fixed output name. Use the same output serial as with the (default) real output names to avoid reusing the same names. Signed-off-by: Olivier Fourdan Acked-by: Michel Dänzer --- hw/xwayland/xwayland-output.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c index 890dd7418..923745144 100644 --- a/hw/xwayland/xwayland-output.c +++ b/hw/xwayland/xwayland-output.c @@ -1174,6 +1174,7 @@ Bool xwl_screen_init_randr_fixed(struct xwl_screen *xwl_screen) { struct xwl_output *xwl_output; + char name[MAX_OUTPUT_NAME] = { 0 }; rrScrPrivPtr rp; RRModePtr mode; @@ -1192,7 +1193,10 @@ xwl_screen_init_randr_fixed(struct xwl_screen *xwl_screen) rp->rrGetInfo = xwl_randr_get_info; rp->rrSetConfig = xwl_randr_set_config_fixed; - xwl_output->randr_output = RROutputCreate(xwl_screen->screen, "XWAYLAND0", 9, NULL); + snprintf(name, MAX_OUTPUT_NAME, "XWAYLAND%d", + xwl_screen_get_next_output_serial(xwl_screen)); + xwl_output->randr_output = RROutputCreate(xwl_screen->screen, name, + strlen(name), NULL); if (!xwl_output->randr_output) { ErrorF("Failed to create RandR output\n"); goto err;