[mutter] screen-cast-stream: Don't broadcast PipeWireStreamAdded signal



commit 2c5404532b00a11e4abbe8e5831de9757347ce9f
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Tue Sep 5 11:38:42 2017 +0800

    screen-cast-stream: Don't broadcast PipeWireStreamAdded signal
    
    The helper function from gdbus-codegen broadcasts the signal emission,
    but we really only care about sending it to the specific peer that
    created the session. Thus, only emit the signal to the particular peer
    that owns the session.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=784199

 src/backends/meta-screen-cast-session.c |  6 ++++++
 src/backends/meta-screen-cast-session.h |  2 ++
 src/backends/meta-screen-cast-stream.c  | 17 ++++++++++++++---
 3 files changed, 22 insertions(+), 3 deletions(-)
---
diff --git a/src/backends/meta-screen-cast-session.c b/src/backends/meta-screen-cast-session.c
index 45d403dca..130bd17c9 100644
--- a/src/backends/meta-screen-cast-session.c
+++ b/src/backends/meta-screen-cast-session.c
@@ -173,6 +173,12 @@ meta_screen_cast_session_get_object_path (MetaScreenCastSession *session)
   return session->object_path;
 }
 
+char *
+meta_screen_cast_session_get_peer_name (MetaScreenCastSession *session)
+{
+  return session->peer_name;
+}
+
 static gboolean
 check_permission (MetaScreenCastSession *session,
                   GDBusMethodInvocation *invocation)
diff --git a/src/backends/meta-screen-cast-session.h b/src/backends/meta-screen-cast-session.h
index 105a65098..ee02e4e2d 100644
--- a/src/backends/meta-screen-cast-session.h
+++ b/src/backends/meta-screen-cast-session.h
@@ -47,6 +47,8 @@ G_DECLARE_FINAL_TYPE (MetaScreenCastSessionHandle,
 
 char * meta_screen_cast_session_get_object_path (MetaScreenCastSession *session);
 
+char * meta_screen_cast_session_get_peer_name (MetaScreenCastSession *session);
+
 MetaScreenCastSession * meta_screen_cast_session_new (MetaScreenCast             *screen_cast,
                                                       MetaScreenCastSessionType   session_type,
                                                       const char                 *peer_name,
diff --git a/src/backends/meta-screen-cast-stream.c b/src/backends/meta-screen-cast-stream.c
index c14f8fd85..e7bc7f216 100644
--- a/src/backends/meta-screen-cast-stream.c
+++ b/src/backends/meta-screen-cast-stream.c
@@ -26,6 +26,7 @@
 
 #include "backends/meta-screen-cast-session.h"
 
+#define META_SCREEN_CAST_STREAM_DBUS_IFACE "org.gnome.Mutter.ScreenCast.Stream"
 #define META_SCREEN_CAST_STREAM_DBUS_PATH "/org/gnome/Mutter/ScreenCast/Stream"
 
 enum
@@ -100,9 +101,19 @@ on_stream_src_ready (MetaScreenCastStreamSrc *src,
                      uint32_t                 node_id,
                      MetaScreenCastStream    *stream)
 {
-  MetaDBusScreenCastStream *skeleton = META_DBUS_SCREEN_CAST_STREAM (stream);
-
-  meta_dbus_screen_cast_stream_emit_pipewire_stream_added (skeleton, node_id);
+  MetaScreenCastStreamPrivate *priv =
+    meta_screen_cast_stream_get_instance_private (stream);
+  GDBusConnection *connection = priv->connection;
+  char *peer_name;
+
+  peer_name = meta_screen_cast_session_get_peer_name (priv->session);
+  g_dbus_connection_emit_signal (connection,
+                                 peer_name,
+                                 priv->object_path,
+                                 META_SCREEN_CAST_STREAM_DBUS_IFACE,
+                                 "PipeWireStreamAdded",
+                                 g_variant_new ("(u)", node_id),
+                                 NULL);
 }
 
 MetaScreenCastSession *


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]