[mutter/wip/rstrode/rhel-8.0.0: 75/117] screen-cast: Add getters to fetch object owners
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/rstrode/rhel-8.0.0: 75/117] screen-cast: Add getters to fetch object owners
- Date: Sun, 17 Feb 2019 17:29:08 +0000 (UTC)
commit 851954b7edc21b2efdaff1227dfeafae7f829b76
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Wed Dec 12 11:35:58 2018 +0100
screen-cast: Add getters to fetch object owners
MetaBackend owns MetaScreenCast which owns MetaScreenCastSession which
owns MetaScreenCastStream. Make it possible to fetch objects in the
oppositev direction too.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/357
src/backends/meta-backend.c | 3 ++-
src/backends/meta-screen-cast-monitor-stream.c | 10 +++++----
src/backends/meta-screen-cast-monitor-stream.h | 10 +++++----
src/backends/meta-screen-cast-session.c | 15 +++++++++++--
src/backends/meta-screen-cast-session.h | 2 ++
src/backends/meta-screen-cast-stream.c | 30 ++++++++++++++++++++++++++
src/backends/meta-screen-cast-stream.h | 6 ++++++
src/backends/meta-screen-cast-window-stream.c | 8 ++++---
src/backends/meta-screen-cast-window-stream.h | 7 +++---
src/backends/meta-screen-cast.c | 15 +++++++++++--
src/backends/meta-screen-cast.h | 6 +++++-
11 files changed, 92 insertions(+), 20 deletions(-)
---
diff --git a/src/backends/meta-backend.c b/src/backends/meta-backend.c
index 888e51cd9..28f1cd92f 100644
--- a/src/backends/meta-backend.c
+++ b/src/backends/meta-backend.c
@@ -456,7 +456,8 @@ meta_backend_real_post_init (MetaBackend *backend)
priv->remote_access_controller =
g_object_new (META_TYPE_REMOTE_ACCESS_CONTROLLER, NULL);
priv->dbus_session_watcher = g_object_new (META_TYPE_DBUS_SESSION_WATCHER, NULL);
- priv->screen_cast = meta_screen_cast_new (priv->dbus_session_watcher);
+ priv->screen_cast = meta_screen_cast_new (backend,
+ priv->dbus_session_watcher);
priv->remote_desktop = meta_remote_desktop_new (priv->dbus_session_watcher);
#endif /* HAVE_REMOTE_DESKTOP */
diff --git a/src/backends/meta-screen-cast-monitor-stream.c b/src/backends/meta-screen-cast-monitor-stream.c
index 5a816e4df..a6bed1b52 100644
--- a/src/backends/meta-screen-cast-monitor-stream.c
+++ b/src/backends/meta-screen-cast-monitor-stream.c
@@ -105,10 +105,11 @@ meta_screen_cast_monitor_stream_get_monitor (MetaScreenCastMonitorStream *monito
}
MetaScreenCastMonitorStream *
-meta_screen_cast_monitor_stream_new (GDBusConnection *connection,
- MetaMonitor *monitor,
- ClutterStage *stage,
- GError **error)
+meta_screen_cast_monitor_stream_new (MetaScreenCastSession *session,
+ GDBusConnection *connection,
+ MetaMonitor *monitor,
+ ClutterStage *stage,
+ GError **error)
{
MetaGpu *gpu = meta_monitor_get_gpu (monitor);
MetaMonitorManager *monitor_manager = meta_gpu_get_monitor_manager (gpu);
@@ -123,6 +124,7 @@ meta_screen_cast_monitor_stream_new (GDBusConnection *connection,
monitor_stream = g_initable_new (META_TYPE_SCREEN_CAST_MONITOR_STREAM,
NULL,
error,
+ "session", session,
"connection", connection,
"monitor", monitor,
NULL);
diff --git a/src/backends/meta-screen-cast-monitor-stream.h b/src/backends/meta-screen-cast-monitor-stream.h
index 1d24de93a..98f160c88 100644
--- a/src/backends/meta-screen-cast-monitor-stream.h
+++ b/src/backends/meta-screen-cast-monitor-stream.h
@@ -27,6 +27,7 @@
#include "backends/meta-monitor-manager-private.h"
#include "backends/meta-screen-cast-stream.h"
+#include "backends/meta-screen-cast.h"
#define META_TYPE_SCREEN_CAST_MONITOR_STREAM (meta_screen_cast_monitor_stream_get_type ())
G_DECLARE_FINAL_TYPE (MetaScreenCastMonitorStream,
@@ -34,10 +35,11 @@ G_DECLARE_FINAL_TYPE (MetaScreenCastMonitorStream,
META, SCREEN_CAST_MONITOR_STREAM,
MetaScreenCastStream)
-MetaScreenCastMonitorStream * meta_screen_cast_monitor_stream_new (GDBusConnection *connection,
- MetaMonitor *monitor,
- ClutterStage *stage,
- GError **error);
+MetaScreenCastMonitorStream * meta_screen_cast_monitor_stream_new (MetaScreenCastSession *session,
+ GDBusConnection *connection,
+ MetaMonitor *monitor,
+ ClutterStage *stage,
+ GError **error);
ClutterStage * meta_screen_cast_monitor_stream_get_stage (MetaScreenCastMonitorStream *monitor_stream);
diff --git a/src/backends/meta-screen-cast-session.c b/src/backends/meta-screen-cast-session.c
index 3ba59037f..6a8f2d328 100644
--- a/src/backends/meta-screen-cast-session.c
+++ b/src/backends/meta-screen-cast-session.c
@@ -38,6 +38,8 @@ struct _MetaScreenCastSession
{
MetaDBusScreenCastSessionSkeleton parent;
+ MetaScreenCast *screen_cast;
+
char *peer_name;
MetaScreenCastSessionType session_type;
@@ -159,6 +161,12 @@ meta_screen_cast_session_get_stream (MetaScreenCastSession *session,
return NULL;
}
+MetaScreenCast *
+meta_screen_cast_session_get_screen_cast (MetaScreenCastSession *session)
+{
+ return session->screen_cast;
+}
+
char *
meta_screen_cast_session_get_object_path (MetaScreenCastSession *session)
{
@@ -300,7 +308,8 @@ handle_record_monitor (MetaDBusScreenCastSession *skeleton,
stage = CLUTTER_STAGE (meta_backend_get_stage (backend));
- monitor_stream = meta_screen_cast_monitor_stream_new (connection,
+ monitor_stream = meta_screen_cast_monitor_stream_new (session,
+ connection,
monitor,
stage,
&error);
@@ -381,7 +390,8 @@ handle_record_window (MetaDBusScreenCastSession *skeleton,
interface_skeleton = G_DBUS_INTERFACE_SKELETON (skeleton);
connection = g_dbus_interface_skeleton_get_connection (interface_skeleton);
- window_stream = meta_screen_cast_window_stream_new (connection,
+ window_stream = meta_screen_cast_window_stream_new (session,
+ connection,
window,
&error);
if (!window_stream)
@@ -441,6 +451,7 @@ meta_screen_cast_session_new (MetaScreenCast *screen_cast,
static unsigned int global_session_number = 0;
session = g_object_new (META_TYPE_SCREEN_CAST_SESSION, NULL);
+ session->screen_cast = screen_cast;
session->session_type = session_type;
session->peer_name = g_strdup (peer_name);
session->object_path =
diff --git a/src/backends/meta-screen-cast-session.h b/src/backends/meta-screen-cast-session.h
index ac0a31a16..105a65098 100644
--- a/src/backends/meta-screen-cast-session.h
+++ b/src/backends/meta-screen-cast-session.h
@@ -60,4 +60,6 @@ void meta_screen_cast_session_close (MetaScreenCastSession *session);
MetaScreenCastStream * meta_screen_cast_session_get_stream (MetaScreenCastSession *session,
const char *path);
+MetaScreenCast * meta_screen_cast_session_get_screen_cast (MetaScreenCastSession *session);
+
#endif /* META_SCREEN_CAST_SESSION_H */
diff --git a/src/backends/meta-screen-cast-stream.c b/src/backends/meta-screen-cast-stream.c
index 97ee4bfcf..875ada01a 100644
--- a/src/backends/meta-screen-cast-stream.c
+++ b/src/backends/meta-screen-cast-stream.c
@@ -24,12 +24,15 @@
#include "backends/meta-screen-cast-stream.h"
+#include "backends/meta-screen-cast-session.h"
+
#define META_SCREEN_CAST_STREAM_DBUS_PATH "/org/gnome/Mutter/ScreenCast/Stream"
enum
{
PROP_0,
+ PROP_SESSION,
PROP_CONNECTION,
};
@@ -44,6 +47,8 @@ static guint signals[N_SIGNALS];
typedef struct _MetaScreenCastStreamPrivate
{
+ MetaScreenCastSession *session;
+
GDBusConnection *connection;
char *object_path;
@@ -97,6 +102,15 @@ on_stream_src_ready (MetaScreenCastStreamSrc *src,
meta_dbus_screen_cast_stream_emit_pipewire_stream_added (skeleton, node_id);
}
+MetaScreenCastSession *
+meta_screen_cast_stream_get_session (MetaScreenCastStream *stream)
+{
+ MetaScreenCastStreamPrivate *priv =
+ meta_screen_cast_stream_get_instance_private (stream);
+
+ return priv->session;
+}
+
gboolean
meta_screen_cast_stream_start (MetaScreenCastStream *stream,
GError **error)
@@ -162,6 +176,9 @@ meta_screen_cast_stream_set_property (GObject *object,
switch (prop_id)
{
+ case PROP_SESSION:
+ priv->session = g_value_get_object (value);
+ break;
case PROP_CONNECTION:
priv->connection = g_value_get_object (value);
break;
@@ -182,6 +199,9 @@ meta_screen_cast_stream_get_property (GObject *object,
switch (prop_id)
{
+ case PROP_SESSION:
+ g_value_set_object (value, priv->session);
+ break;
case PROP_CONNECTION:
g_value_set_object (value, priv->connection);
break;
@@ -256,6 +276,16 @@ meta_screen_cast_stream_class_init (MetaScreenCastStreamClass *klass)
object_class->set_property = meta_screen_cast_stream_set_property;
object_class->get_property = meta_screen_cast_stream_get_property;
+ g_object_class_install_property (object_class,
+ PROP_SESSION,
+ g_param_spec_object ("session",
+ "session",
+ "MetaScreenSession",
+ META_TYPE_SCREEN_CAST_SESSION,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS));
+
g_object_class_install_property (object_class,
PROP_CONNECTION,
g_param_spec_object ("connection",
diff --git a/src/backends/meta-screen-cast-stream.h b/src/backends/meta-screen-cast-stream.h
index fd7930c4c..dcc280da6 100644
--- a/src/backends/meta-screen-cast-stream.h
+++ b/src/backends/meta-screen-cast-stream.h
@@ -26,8 +26,12 @@
#include <glib-object.h>
#include "backends/meta-screen-cast-stream-src.h"
+#include "backends/meta-screen-cast.h"
+
#include "meta-dbus-screen-cast.h"
+typedef struct _MetaScreenCastSession MetaScreenCastSession;
+
#define META_TYPE_SCREEN_CAST_STREAM (meta_screen_cast_stream_get_type ())
G_DECLARE_DERIVABLE_TYPE (MetaScreenCastStream, meta_screen_cast_stream,
META, SCREEN_CAST_STREAM,
@@ -48,6 +52,8 @@ struct _MetaScreenCastStreamClass
double *y);
};
+MetaScreenCastSession * meta_screen_cast_stream_get_session (MetaScreenCastStream *stream);
+
gboolean meta_screen_cast_stream_start (MetaScreenCastStream *stream,
GError **error);
diff --git a/src/backends/meta-screen-cast-window-stream.c b/src/backends/meta-screen-cast-window-stream.c
index 1200a39ef..4c9227116 100644
--- a/src/backends/meta-screen-cast-window-stream.c
+++ b/src/backends/meta-screen-cast-window-stream.c
@@ -71,9 +71,10 @@ meta_screen_cast_window_stream_get_height (MetaScreenCastWindowStream *window_st
}
MetaScreenCastWindowStream *
-meta_screen_cast_window_stream_new (GDBusConnection *connection,
- MetaWindow *window,
- GError **error)
+meta_screen_cast_window_stream_new (MetaScreenCastSession *session,
+ GDBusConnection *connection,
+ MetaWindow *window,
+ GError **error)
{
MetaScreenCastWindowStream *window_stream;
MetaLogicalMonitor *logical_monitor;
@@ -90,6 +91,7 @@ meta_screen_cast_window_stream_new (GDBusConnection *connection,
window_stream = g_initable_new (META_TYPE_SCREEN_CAST_WINDOW_STREAM,
NULL,
error,
+ "session", session,
"connection", connection,
"window", window,
NULL);
diff --git a/src/backends/meta-screen-cast-window-stream.h b/src/backends/meta-screen-cast-window-stream.h
index 6726ef873..3799be98a 100644
--- a/src/backends/meta-screen-cast-window-stream.h
+++ b/src/backends/meta-screen-cast-window-stream.h
@@ -32,9 +32,10 @@ G_DECLARE_FINAL_TYPE (MetaScreenCastWindowStream,
META, SCREEN_CAST_WINDOW_STREAM,
MetaScreenCastStream)
-MetaScreenCastWindowStream * meta_screen_cast_window_stream_new (GDBusConnection *connection,
- MetaWindow *window,
- GError **error);
+MetaScreenCastWindowStream * meta_screen_cast_window_stream_new (MetaScreenCastSession *session,
+ GDBusConnection *connection,
+ MetaWindow *window,
+ GError **error);
MetaWindow * meta_screen_cast_window_stream_get_window (MetaScreenCastWindowStream *window_stream);
int meta_screen_cast_window_stream_get_width (MetaScreenCastWindowStream *window_stream);
diff --git a/src/backends/meta-screen-cast.c b/src/backends/meta-screen-cast.c
index 4a67683e7..ceea9cbe1 100644
--- a/src/backends/meta-screen-cast.c
+++ b/src/backends/meta-screen-cast.c
@@ -43,6 +43,7 @@ struct _MetaScreenCast
GList *sessions;
MetaDbusSessionWatcher *session_watcher;
+ MetaBackend *backend;
};
static void
@@ -62,12 +63,20 @@ meta_screen_cast_get_connection (MetaScreenCast *screen_cast)
return g_dbus_interface_skeleton_get_connection (interface_skeleton);
}
+MetaBackend *
+meta_screen_cast_get_backend (MetaScreenCast *screen_cast)
+{
+ return screen_cast->backend;
+}
+
static gboolean
register_remote_desktop_screen_cast_session (MetaScreenCastSession *session,
const char *remote_desktop_session_id,
GError **error)
{
- MetaBackend *backend = meta_get_backend ();
+ MetaScreenCast *screen_cast =
+ meta_screen_cast_session_get_screen_cast (session);
+ MetaBackend *backend = meta_screen_cast_get_backend (screen_cast);
MetaRemoteDesktop *remote_desktop = meta_backend_get_remote_desktop (backend);
MetaRemoteDesktopSession *remote_desktop_session;
@@ -244,11 +253,13 @@ meta_screen_cast_finalize (GObject *object)
}
MetaScreenCast *
-meta_screen_cast_new (MetaDbusSessionWatcher *session_watcher)
+meta_screen_cast_new (MetaBackend *backend,
+ MetaDbusSessionWatcher *session_watcher)
{
MetaScreenCast *screen_cast;
screen_cast = g_object_new (META_TYPE_SCREEN_CAST, NULL);
+ screen_cast->backend = backend;
screen_cast->session_watcher = session_watcher;
return screen_cast;
diff --git a/src/backends/meta-screen-cast.h b/src/backends/meta-screen-cast.h
index a4fb8dd45..7e32b67b7 100644
--- a/src/backends/meta-screen-cast.h
+++ b/src/backends/meta-screen-cast.h
@@ -25,6 +25,7 @@
#include <glib-object.h>
+#include "backends/meta-backend-private.h"
#include "backends/meta-dbus-session-watcher.h"
#include "meta-dbus-screen-cast.h"
@@ -35,6 +36,9 @@ G_DECLARE_FINAL_TYPE (MetaScreenCast, meta_screen_cast,
GDBusConnection * meta_screen_cast_get_connection (MetaScreenCast *screen_cast);
-MetaScreenCast * meta_screen_cast_new (MetaDbusSessionWatcher *session_watcher);
+MetaBackend * meta_screen_cast_get_backend (MetaScreenCast *screen_cast);
+
+MetaScreenCast * meta_screen_cast_new (MetaBackend *backend,
+ MetaDbusSessionWatcher *session_watcher);
#endif /* META_SCREEN_CAST_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]