From bb7ed37a89f3698509986d1de64897797981a70b Mon Sep 17 00:00:00 2001 From: Marius Vlad Date: Thu, 5 Nov 2020 19:30:51 +0200 Subject: [PATCH] remoting,pipewire: Use the connector and the output name for the head name Makes the client's life much easier to identify between multiple remote outputs. xdg_output is advertising (in later versions) the head name, but in case we have different plug-ins or multiple remote outputs created, it would only repeat/advertise the same name for all (remoting) outputs. This instead uses a string that uses both the connector and name to derive a more easier identifier a client can choose from. Signed-off-by: Marius Vlad --- pipewire/pipewire-plugin.c | 7 ++++++- remoting/remoting-plugin.c | 5 ++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pipewire/pipewire-plugin.c b/pipewire/pipewire-plugin.c index 2c65f502..ca5cbfec 100644 --- a/pipewire/pipewire-plugin.c +++ b/pipewire/pipewire-plugin.c @@ -23,6 +23,8 @@ * SOFTWARE. */ +#include "config.h" + #include #include "backend.h" #include "libweston-internal.h" @@ -630,6 +632,7 @@ pipewire_output_create(struct weston_compositor *c, char *name) const char *model = "Virtual Display"; const char *serial_number = "unknown"; const char *connector_name = "pipewire"; + char *remoting_name; if (!name || !strlen(name)) return NULL; @@ -672,7 +675,8 @@ pipewire_output_create(struct weston_compositor *c, char *name) output->pipewire = pipewire; wl_list_insert(pipewire->output_list.prev, &output->link); - weston_head_init(head, connector_name); + asprintf(&remoting_name, "%s-%s", connector_name, name); + weston_head_init(head, remoting_name); weston_head_set_subpixel(head, WL_OUTPUT_SUBPIXEL_NONE); weston_head_set_monitor_strings(head, make, model, serial_number); head->compositor = c; @@ -680,6 +684,7 @@ pipewire_output_create(struct weston_compositor *c, char *name) weston_output_attach_head(output->output, head); + free(remoting_name); pipewire_output_debug(output, "created"); return output->output; diff --git a/remoting/remoting-plugin.c b/remoting/remoting-plugin.c index a1d994ea..ada101c5 100644 --- a/remoting/remoting-plugin.c +++ b/remoting/remoting-plugin.c @@ -741,6 +741,7 @@ remoting_output_create(struct weston_compositor *c, char *name) const char *model = "Virtual Display"; const char *serial_number = "unknown"; const char *connector_name = "remoting"; + char *remoting_name; if (!name || !strlen(name)) return NULL; @@ -775,7 +776,8 @@ remoting_output_create(struct weston_compositor *c, char *name) output->remoting = remoting; wl_list_insert(remoting->output_list.prev, &output->link); - weston_head_init(head, connector_name); + asprintf(&remoting_name, "%s-%s", connector_name, name); + weston_head_init(head, remoting_name); weston_head_set_subpixel(head, WL_OUTPUT_SUBPIXEL_NONE); weston_head_set_monitor_strings(head, make, model, serial_number); head->compositor = c; @@ -785,6 +787,7 @@ remoting_output_create(struct weston_compositor *c, char *name) /* set XRGB8888 format */ output->format = &supported_formats[0]; + free(remoting_name); return output->output;