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 <marius.vlad@collabora.com>
This commit is contained in:
Marius Vlad 2020-11-05 19:30:51 +02:00
parent cf83b48be4
commit bb7ed37a89
2 changed files with 10 additions and 2 deletions

View file

@ -23,6 +23,8 @@
* SOFTWARE.
*/
#include "config.h"
#include <libweston/pipewire-plugin.h>
#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;

View file

@ -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;