summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorOlivier Fourdan <ofourdan@redhat.com>2024-04-17 15:47:32 +0200
committerOlivier Fourdan <ofourdan@redhat.com>2024-05-02 10:17:32 +0200
commit74d02b98abd095c617894dfcb25980ae5224e936 (patch)
treea24acb6c438a21539c4e6b999d8bd914dbd2cfb3 /hw
parentaa17d7eba6c7abda436af62663d00d63ef282f61 (diff)
xwayland: Use the connector name for XRANDR leases
Use the connector name as basis for the Xwayland output name in XRANDR, similar to what we do for regular outputs, instead of the generic "XWAYLAND<n>" name which changes every time the output is leased. Prefix the actual name with "lease-" to distinguish from duplicate names from the regular outputs. v2: avoid duplicate names (Simon) v3: Move the check for duplicates to xwl_output_set_name() (Simon) Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> (cherry picked from commit 49b8f131f7b1df2f3c4a3bde010d67e0b448246c) Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1494>
Diffstat (limited to 'hw')
-rw-r--r--hw/xwayland/xwayland-drm-lease.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/hw/xwayland/xwayland-drm-lease.c b/hw/xwayland/xwayland-drm-lease.c
index 51c92872e..4f9004d8c 100644
--- a/hw/xwayland/xwayland-drm-lease.c
+++ b/hw/xwayland/xwayland-drm-lease.c
@@ -189,7 +189,11 @@ lease_connector_handle_name(void *data,
struct wp_drm_lease_connector_v1 *wp_drm_lease_connector_v1,
const char *name)
{
- /* This space is deliberately left blank */
+ struct xwl_output *xwl_output = data;
+ char rr_output_name[MAX_OUTPUT_NAME] = { 0 };
+
+ snprintf(rr_output_name, MAX_OUTPUT_NAME, "lease-%s", name);
+ xwl_output_set_name(xwl_output, rr_output_name);
}
static void
@@ -347,7 +351,7 @@ drm_lease_device_handle_connector(void *data,
struct xwl_drm_lease_device *lease_device = data;
struct xwl_screen *xwl_screen = lease_device->xwl_screen;
struct xwl_output *xwl_output;
- char name[256];
+ char name[MAX_OUTPUT_NAME] = { 0 };
xwl_output = calloc(1, sizeof *xwl_output);
if (xwl_output == NULL) {
@@ -355,9 +359,6 @@ drm_lease_device_handle_connector(void *data,
return;
}
- snprintf(name, sizeof name, "XWAYLAND%d",
- xwl_screen_get_next_output_serial(xwl_screen));
-
xwl_output->lease_device = lease_device;
xwl_output->xwl_screen = xwl_screen;
xwl_output->lease_connector = connector;
@@ -368,7 +369,11 @@ drm_lease_device_handle_connector(void *data,
}
RRCrtcSetRotations(xwl_output->randr_crtc, ALL_ROTATIONS);
xwl_output->randr_output = RROutputCreate(xwl_screen->screen,
- name, strlen(name), xwl_output);
+ name, MAX_OUTPUT_NAME, xwl_output);
+ snprintf(name, MAX_OUTPUT_NAME, "XWAYLAND%d",
+ xwl_screen_get_next_output_serial(xwl_screen));
+ xwl_output_set_name(xwl_output, name);
+
if (!xwl_output->randr_output) {
ErrorF("Failed creating RandR Output\n");
goto err;