From e2d4da8562507efa334617bce405eafd65e1d15a Mon Sep 17 00:00:00 2001 From: Salman Malik Date: Tue, 2 Aug 2022 17:08:10 +0000 Subject: [PATCH] screen-cast-stream: Embed the wayland output name to streams If a screencast session is screencasting from multiple monitors, it is not possible to distinguish which stream (or PipeWire stream node id) belongs to which connected monitor (such information may be useful to the caller e.g. caller might want to embed the stream in a window and name it after the monitor connector, for example). This change adds optional metadata for monitor streams to also return the wayland output name with the stream. Ideally, this metadata should equip the caller to get more information about display from the following Wayland interfaces: https://wayland.freedesktop.org/docs/html/apa.html#protocol-spec-wl_output https://wayland.app/protocols/xdg-output-unstable-v1 Related: - https://github.com/flatpak/xdg-desktop-portal/pull/832 - https://gitlab.gnome.org/GNOME/xdg-desktop-portal-gnome/-/merge_requests/48 Part-of: --- data/dbus-interfaces/org.gnome.Mutter.ScreenCast.xml | 3 +++ src/backends/meta-screen-cast-monitor-stream.c | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/data/dbus-interfaces/org.gnome.Mutter.ScreenCast.xml b/data/dbus-interfaces/org.gnome.Mutter.ScreenCast.xml index 54d296548..345650732 100644 --- a/data/dbus-interfaces/org.gnome.Mutter.ScreenCast.xml +++ b/data/dbus-interfaces/org.gnome.Mutter.ScreenCast.xml @@ -221,6 +221,9 @@ compositor coordinate space. * "size" (ii): Size of the source of the stream in the compositor coordinate space. + * "output-name" s: Xrandr name of the output in case of X11 and + wl_output.name in case of Wayland. Available only + for monitor streams. --> diff --git a/src/backends/meta-screen-cast-monitor-stream.c b/src/backends/meta-screen-cast-monitor-stream.c index ada9bc95f..5d54d6168 100644 --- a/src/backends/meta-screen-cast-monitor-stream.c +++ b/src/backends/meta-screen-cast-monitor-stream.c @@ -168,6 +168,7 @@ meta_screen_cast_monitor_stream_set_parameters (MetaScreenCastStream *stream, MetaScreenCastMonitorStream *monitor_stream = META_SCREEN_CAST_MONITOR_STREAM (stream); MetaRectangle logical_monitor_layout; + const char *output_name; logical_monitor_layout = meta_logical_monitor_get_layout (monitor_stream->logical_monitor); @@ -182,6 +183,10 @@ meta_screen_cast_monitor_stream_set_parameters (MetaScreenCastStream *stream, g_variant_new ("(ii)", logical_monitor_layout.width, logical_monitor_layout.height)); + + output_name = meta_monitor_get_connector (monitor_stream->monitor); + g_variant_builder_add (parameters_builder, "{sv}", "output-name", + g_variant_new ("s", output_name)); } static gboolean