diff --git a/src/backends/meta-screen-cast-monitor-stream.c b/src/backends/meta-screen-cast-monitor-stream.c
index 1630b8eea..ece7efcdd 100644
--- a/src/backends/meta-screen-cast-monitor-stream.c
+++ b/src/backends/meta-screen-cast-monitor-stream.c
@@ -27,6 +27,13 @@
#include "backends/meta-logical-monitor.h"
#include "backends/meta-screen-cast-monitor-stream-src.h"
+enum
+{
+ PROP_0,
+
+ PROP_MONITOR,
+};
+
struct _MetaScreenCastMonitorStream
{
MetaScreenCastStream parent;
@@ -105,10 +112,8 @@ meta_screen_cast_monitor_stream_new (GDBusConnection *connection,
GError **error)
{
MetaScreenCastMonitorStream *monitor_stream;
- MetaLogicalMonitor *logical_monitor;
- logical_monitor = meta_monitor_get_logical_monitor (monitor);
- if (!logical_monitor)
+ if (!meta_monitor_is_active (monitor))
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "Monitor not active");
return NULL;
@@ -118,12 +123,11 @@ meta_screen_cast_monitor_stream_new (GDBusConnection *connection,
NULL,
error,
"connection", connection,
+ "monitor", monitor,
NULL);
if (!monitor_stream)
return NULL;
- g_set_object (&monitor_stream->monitor, monitor);
- g_set_object (&monitor_stream->logical_monitor, logical_monitor);
monitor_stream->stage = stage;
g_signal_connect_object (monitor_manager, "monitors-changed",
@@ -149,6 +153,70 @@ meta_screen_cast_monitor_stream_create_src (MetaScreenCastStream *stream,
return META_SCREEN_CAST_STREAM_SRC (monitor_stream_src);
}
+static void
+meta_screen_cast_monitor_stream_set_parameters (MetaScreenCastStream *stream,
+ GVariantBuilder *parameters_builder)
+{
+ MetaScreenCastMonitorStream *monitor_stream =
+ META_SCREEN_CAST_MONITOR_STREAM (stream);
+ MetaRectangle logical_monitor_layout;
+
+ logical_monitor_layout =
+ meta_logical_monitor_get_layout (monitor_stream->logical_monitor);
+
+ g_variant_builder_add (parameters_builder, "{sv}",
+ "position",
+ g_variant_new ("(ii)",
+ logical_monitor_layout.x,
+ logical_monitor_layout.y));
+ g_variant_builder_add (parameters_builder, "{sv}",
+ "size",
+ g_variant_new ("(ii)",
+ logical_monitor_layout.width,
+ logical_monitor_layout.height));
+}
+
+static void
+meta_screen_cast_monitor_stream_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ MetaScreenCastMonitorStream *monitor_stream =
+ META_SCREEN_CAST_MONITOR_STREAM (object);
+ MetaLogicalMonitor *logical_monitor;
+
+ switch (prop_id)
+ {
+ case PROP_MONITOR:
+ g_set_object (&monitor_stream->monitor, g_value_get_object (value));
+ logical_monitor = meta_monitor_get_logical_monitor (monitor_stream->monitor);
+ g_set_object (&monitor_stream->logical_monitor, logical_monitor);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
+}
+
+static void
+meta_screen_cast_monitor_stream_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ MetaScreenCastMonitorStream *monitor_stream =
+ META_SCREEN_CAST_MONITOR_STREAM (object);
+
+ switch (prop_id)
+ {
+ case PROP_MONITOR:
+ g_value_set_object (value, monitor_stream->monitor);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
+}
+
static void
meta_screen_cast_monitor_stream_finalize (GObject *object)
{
@@ -173,7 +241,20 @@ meta_screen_cast_monitor_stream_class_init (MetaScreenCastMonitorStreamClass *kl
MetaScreenCastStreamClass *stream_class =
META_SCREEN_CAST_STREAM_CLASS (klass);
+ object_class->set_property = meta_screen_cast_monitor_stream_set_property;
+ object_class->get_property = meta_screen_cast_monitor_stream_get_property;
object_class->finalize = meta_screen_cast_monitor_stream_finalize;
stream_class->create_src = meta_screen_cast_monitor_stream_create_src;
+ stream_class->set_parameters = meta_screen_cast_monitor_stream_set_parameters;
+
+ g_object_class_install_property (object_class,
+ PROP_MONITOR,
+ g_param_spec_object ("monitor",
+ "monitor",
+ "MetaMonitor",
+ META_TYPE_MONITOR,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS));
}
diff --git a/src/backends/meta-screen-cast-stream.c b/src/backends/meta-screen-cast-stream.c
index 1a8ef6b8d..1c9613585 100644
--- a/src/backends/meta-screen-cast-stream.c
+++ b/src/backends/meta-screen-cast-stream.c
@@ -68,6 +68,14 @@ meta_screen_cast_stream_create_src (MetaScreenCastStream *stream,
error);
}
+static void
+meta_screen_cast_stream_set_parameters (MetaScreenCastStream *stream,
+ GVariantBuilder *parameters_builder)
+{
+ META_SCREEN_CAST_STREAM_GET_CLASS (stream)->set_parameters (stream,
+ parameters_builder);
+}
+
static void
on_stream_src_closed (MetaScreenCastStreamSrc *src,
MetaScreenCastStream *stream)
@@ -189,10 +197,19 @@ meta_screen_cast_stream_initable_init (GInitable *initable,
GError **error)
{
MetaScreenCastStream *stream = META_SCREEN_CAST_STREAM (initable);
+ MetaDBusScreenCastStream *skeleton = META_DBUS_SCREEN_CAST_STREAM (stream);
MetaScreenCastStreamPrivate *priv =
meta_screen_cast_stream_get_instance_private (stream);
+ GVariantBuilder parameters_builder;
+ GVariant *parameters_variant;
static unsigned int global_stream_number = 0;
+ g_variant_builder_init (¶meters_builder, G_VARIANT_TYPE_VARDICT);
+ meta_screen_cast_stream_set_parameters (stream, ¶meters_builder);
+
+ parameters_variant = g_variant_builder_end (¶meters_builder);
+ meta_dbus_screen_cast_stream_set_parameters (skeleton, parameters_variant);
+
priv->object_path =
g_strdup_printf (META_SCREEN_CAST_STREAM_DBUS_PATH "/u%u",
++global_stream_number);
diff --git a/src/backends/meta-screen-cast-stream.h b/src/backends/meta-screen-cast-stream.h
index 1ed1a837c..36706ee7e 100644
--- a/src/backends/meta-screen-cast-stream.h
+++ b/src/backends/meta-screen-cast-stream.h
@@ -39,6 +39,8 @@ struct _MetaScreenCastStreamClass
MetaScreenCastStreamSrc * (* create_src) (MetaScreenCastStream *stream,
GError **error);
+ void (* set_parameters) (MetaScreenCastStream *stream,
+ GVariantBuilder *parameters_builder);
};
gboolean meta_screen_cast_stream_start (MetaScreenCastStream *stream,
diff --git a/src/org.gnome.Mutter.ScreenCast.xml b/src/org.gnome.Mutter.ScreenCast.xml
index f774091d8..409247b03 100644
--- a/src/org.gnome.Mutter.ScreenCast.xml
+++ b/src/org.gnome.Mutter.ScreenCast.xml
@@ -102,6 +102,19 @@
+
+
+