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
This commit is contained in:
parent
08229a6f5d
commit
0da0207eed
@ -49,4 +49,8 @@ typedef struct _MetaTileInfo MetaTileInfo;
|
|||||||
typedef struct _MetaRenderer MetaRenderer;
|
typedef struct _MetaRenderer MetaRenderer;
|
||||||
typedef struct _MetaRendererView MetaRendererView;
|
typedef struct _MetaRendererView MetaRendererView;
|
||||||
|
|
||||||
|
typedef struct _MetaScreenCast MetaScreenCast;
|
||||||
|
typedef struct _MetaScreenCastSession MetaScreenCastSession;
|
||||||
|
typedef struct _MetaScreenCastStream MetaScreenCastStream;
|
||||||
|
|
||||||
#endif /* META_BACKEND_TYPE_H */
|
#endif /* META_BACKEND_TYPE_H */
|
||||||
|
@ -504,7 +504,8 @@ meta_backend_real_post_init (MetaBackend *backend)
|
|||||||
priv->remote_access_controller =
|
priv->remote_access_controller =
|
||||||
g_object_new (META_TYPE_REMOTE_ACCESS_CONTROLLER, NULL);
|
g_object_new (META_TYPE_REMOTE_ACCESS_CONTROLLER, NULL);
|
||||||
priv->dbus_session_watcher = g_object_new (META_TYPE_DBUS_SESSION_WATCHER, 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);
|
priv->remote_desktop = meta_remote_desktop_new (priv->dbus_session_watcher);
|
||||||
#endif /* HAVE_REMOTE_DESKTOP */
|
#endif /* HAVE_REMOTE_DESKTOP */
|
||||||
|
|
||||||
|
@ -105,10 +105,11 @@ meta_screen_cast_monitor_stream_get_monitor (MetaScreenCastMonitorStream *monito
|
|||||||
}
|
}
|
||||||
|
|
||||||
MetaScreenCastMonitorStream *
|
MetaScreenCastMonitorStream *
|
||||||
meta_screen_cast_monitor_stream_new (GDBusConnection *connection,
|
meta_screen_cast_monitor_stream_new (MetaScreenCastSession *session,
|
||||||
MetaMonitor *monitor,
|
GDBusConnection *connection,
|
||||||
ClutterStage *stage,
|
MetaMonitor *monitor,
|
||||||
GError **error)
|
ClutterStage *stage,
|
||||||
|
GError **error)
|
||||||
{
|
{
|
||||||
MetaGpu *gpu = meta_monitor_get_gpu (monitor);
|
MetaGpu *gpu = meta_monitor_get_gpu (monitor);
|
||||||
MetaMonitorManager *monitor_manager = meta_gpu_get_monitor_manager (gpu);
|
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,
|
monitor_stream = g_initable_new (META_TYPE_SCREEN_CAST_MONITOR_STREAM,
|
||||||
NULL,
|
NULL,
|
||||||
error,
|
error,
|
||||||
|
"session", session,
|
||||||
"connection", connection,
|
"connection", connection,
|
||||||
"monitor", monitor,
|
"monitor", monitor,
|
||||||
NULL);
|
NULL);
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
#include "backends/meta-monitor-manager-private.h"
|
#include "backends/meta-monitor-manager-private.h"
|
||||||
#include "backends/meta-screen-cast-stream.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 ())
|
#define META_TYPE_SCREEN_CAST_MONITOR_STREAM (meta_screen_cast_monitor_stream_get_type ())
|
||||||
G_DECLARE_FINAL_TYPE (MetaScreenCastMonitorStream,
|
G_DECLARE_FINAL_TYPE (MetaScreenCastMonitorStream,
|
||||||
@ -34,10 +35,11 @@ G_DECLARE_FINAL_TYPE (MetaScreenCastMonitorStream,
|
|||||||
META, SCREEN_CAST_MONITOR_STREAM,
|
META, SCREEN_CAST_MONITOR_STREAM,
|
||||||
MetaScreenCastStream)
|
MetaScreenCastStream)
|
||||||
|
|
||||||
MetaScreenCastMonitorStream * meta_screen_cast_monitor_stream_new (GDBusConnection *connection,
|
MetaScreenCastMonitorStream * meta_screen_cast_monitor_stream_new (MetaScreenCastSession *session,
|
||||||
MetaMonitor *monitor,
|
GDBusConnection *connection,
|
||||||
ClutterStage *stage,
|
MetaMonitor *monitor,
|
||||||
GError **error);
|
ClutterStage *stage,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
ClutterStage * meta_screen_cast_monitor_stream_get_stage (MetaScreenCastMonitorStream *monitor_stream);
|
ClutterStage * meta_screen_cast_monitor_stream_get_stage (MetaScreenCastMonitorStream *monitor_stream);
|
||||||
|
|
||||||
|
@ -38,6 +38,8 @@ struct _MetaScreenCastSession
|
|||||||
{
|
{
|
||||||
MetaDBusScreenCastSessionSkeleton parent;
|
MetaDBusScreenCastSessionSkeleton parent;
|
||||||
|
|
||||||
|
MetaScreenCast *screen_cast;
|
||||||
|
|
||||||
char *peer_name;
|
char *peer_name;
|
||||||
|
|
||||||
MetaScreenCastSessionType session_type;
|
MetaScreenCastSessionType session_type;
|
||||||
@ -159,6 +161,12 @@ meta_screen_cast_session_get_stream (MetaScreenCastSession *session,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MetaScreenCast *
|
||||||
|
meta_screen_cast_session_get_screen_cast (MetaScreenCastSession *session)
|
||||||
|
{
|
||||||
|
return session->screen_cast;
|
||||||
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
meta_screen_cast_session_get_object_path (MetaScreenCastSession *session)
|
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));
|
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,
|
monitor,
|
||||||
stage,
|
stage,
|
||||||
&error);
|
&error);
|
||||||
@ -381,7 +390,8 @@ handle_record_window (MetaDBusScreenCastSession *skeleton,
|
|||||||
interface_skeleton = G_DBUS_INTERFACE_SKELETON (skeleton);
|
interface_skeleton = G_DBUS_INTERFACE_SKELETON (skeleton);
|
||||||
connection = g_dbus_interface_skeleton_get_connection (interface_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,
|
window,
|
||||||
&error);
|
&error);
|
||||||
if (!window_stream)
|
if (!window_stream)
|
||||||
@ -441,6 +451,7 @@ meta_screen_cast_session_new (MetaScreenCast *screen_cast,
|
|||||||
static unsigned int global_session_number = 0;
|
static unsigned int global_session_number = 0;
|
||||||
|
|
||||||
session = g_object_new (META_TYPE_SCREEN_CAST_SESSION, NULL);
|
session = g_object_new (META_TYPE_SCREEN_CAST_SESSION, NULL);
|
||||||
|
session->screen_cast = screen_cast;
|
||||||
session->session_type = session_type;
|
session->session_type = session_type;
|
||||||
session->peer_name = g_strdup (peer_name);
|
session->peer_name = g_strdup (peer_name);
|
||||||
session->object_path =
|
session->object_path =
|
||||||
|
@ -60,4 +60,6 @@ void meta_screen_cast_session_close (MetaScreenCastSession *session);
|
|||||||
MetaScreenCastStream * meta_screen_cast_session_get_stream (MetaScreenCastSession *session,
|
MetaScreenCastStream * meta_screen_cast_session_get_stream (MetaScreenCastSession *session,
|
||||||
const char *path);
|
const char *path);
|
||||||
|
|
||||||
|
MetaScreenCast * meta_screen_cast_session_get_screen_cast (MetaScreenCastSession *session);
|
||||||
|
|
||||||
#endif /* META_SCREEN_CAST_SESSION_H */
|
#endif /* META_SCREEN_CAST_SESSION_H */
|
||||||
|
@ -24,12 +24,15 @@
|
|||||||
|
|
||||||
#include "backends/meta-screen-cast-stream.h"
|
#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"
|
#define META_SCREEN_CAST_STREAM_DBUS_PATH "/org/gnome/Mutter/ScreenCast/Stream"
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
PROP_0,
|
PROP_0,
|
||||||
|
|
||||||
|
PROP_SESSION,
|
||||||
PROP_CONNECTION,
|
PROP_CONNECTION,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -44,6 +47,8 @@ static guint signals[N_SIGNALS];
|
|||||||
|
|
||||||
typedef struct _MetaScreenCastStreamPrivate
|
typedef struct _MetaScreenCastStreamPrivate
|
||||||
{
|
{
|
||||||
|
MetaScreenCastSession *session;
|
||||||
|
|
||||||
GDBusConnection *connection;
|
GDBusConnection *connection;
|
||||||
char *object_path;
|
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);
|
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
|
gboolean
|
||||||
meta_screen_cast_stream_start (MetaScreenCastStream *stream,
|
meta_screen_cast_stream_start (MetaScreenCastStream *stream,
|
||||||
GError **error)
|
GError **error)
|
||||||
@ -162,6 +176,9 @@ meta_screen_cast_stream_set_property (GObject *object,
|
|||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
|
case PROP_SESSION:
|
||||||
|
priv->session = g_value_get_object (value);
|
||||||
|
break;
|
||||||
case PROP_CONNECTION:
|
case PROP_CONNECTION:
|
||||||
priv->connection = g_value_get_object (value);
|
priv->connection = g_value_get_object (value);
|
||||||
break;
|
break;
|
||||||
@ -182,6 +199,9 @@ meta_screen_cast_stream_get_property (GObject *object,
|
|||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
|
case PROP_SESSION:
|
||||||
|
g_value_set_object (value, priv->session);
|
||||||
|
break;
|
||||||
case PROP_CONNECTION:
|
case PROP_CONNECTION:
|
||||||
g_value_set_object (value, priv->connection);
|
g_value_set_object (value, priv->connection);
|
||||||
break;
|
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->set_property = meta_screen_cast_stream_set_property;
|
||||||
object_class->get_property = meta_screen_cast_stream_get_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,
|
g_object_class_install_property (object_class,
|
||||||
PROP_CONNECTION,
|
PROP_CONNECTION,
|
||||||
g_param_spec_object ("connection",
|
g_param_spec_object ("connection",
|
||||||
|
@ -26,6 +26,8 @@
|
|||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
|
|
||||||
#include "backends/meta-screen-cast-stream-src.h"
|
#include "backends/meta-screen-cast-stream-src.h"
|
||||||
|
#include "backends/meta-screen-cast.h"
|
||||||
|
|
||||||
#include "meta-dbus-screen-cast.h"
|
#include "meta-dbus-screen-cast.h"
|
||||||
|
|
||||||
#define META_TYPE_SCREEN_CAST_STREAM (meta_screen_cast_stream_get_type ())
|
#define META_TYPE_SCREEN_CAST_STREAM (meta_screen_cast_stream_get_type ())
|
||||||
@ -48,6 +50,8 @@ struct _MetaScreenCastStreamClass
|
|||||||
double *y);
|
double *y);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
MetaScreenCastSession * meta_screen_cast_stream_get_session (MetaScreenCastStream *stream);
|
||||||
|
|
||||||
gboolean meta_screen_cast_stream_start (MetaScreenCastStream *stream,
|
gboolean meta_screen_cast_stream_start (MetaScreenCastStream *stream,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
|
@ -71,9 +71,10 @@ meta_screen_cast_window_stream_get_height (MetaScreenCastWindowStream *window_st
|
|||||||
}
|
}
|
||||||
|
|
||||||
MetaScreenCastWindowStream *
|
MetaScreenCastWindowStream *
|
||||||
meta_screen_cast_window_stream_new (GDBusConnection *connection,
|
meta_screen_cast_window_stream_new (MetaScreenCastSession *session,
|
||||||
MetaWindow *window,
|
GDBusConnection *connection,
|
||||||
GError **error)
|
MetaWindow *window,
|
||||||
|
GError **error)
|
||||||
{
|
{
|
||||||
MetaScreenCastWindowStream *window_stream;
|
MetaScreenCastWindowStream *window_stream;
|
||||||
MetaLogicalMonitor *logical_monitor;
|
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,
|
window_stream = g_initable_new (META_TYPE_SCREEN_CAST_WINDOW_STREAM,
|
||||||
NULL,
|
NULL,
|
||||||
error,
|
error,
|
||||||
|
"session", session,
|
||||||
"connection", connection,
|
"connection", connection,
|
||||||
"window", window,
|
"window", window,
|
||||||
NULL);
|
NULL);
|
||||||
|
@ -32,9 +32,10 @@ G_DECLARE_FINAL_TYPE (MetaScreenCastWindowStream,
|
|||||||
META, SCREEN_CAST_WINDOW_STREAM,
|
META, SCREEN_CAST_WINDOW_STREAM,
|
||||||
MetaScreenCastStream)
|
MetaScreenCastStream)
|
||||||
|
|
||||||
MetaScreenCastWindowStream * meta_screen_cast_window_stream_new (GDBusConnection *connection,
|
MetaScreenCastWindowStream * meta_screen_cast_window_stream_new (MetaScreenCastSession *session,
|
||||||
MetaWindow *window,
|
GDBusConnection *connection,
|
||||||
GError **error);
|
MetaWindow *window,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
MetaWindow * meta_screen_cast_window_stream_get_window (MetaScreenCastWindowStream *window_stream);
|
MetaWindow * meta_screen_cast_window_stream_get_window (MetaScreenCastWindowStream *window_stream);
|
||||||
int meta_screen_cast_window_stream_get_width (MetaScreenCastWindowStream *window_stream);
|
int meta_screen_cast_window_stream_get_width (MetaScreenCastWindowStream *window_stream);
|
||||||
|
@ -43,6 +43,7 @@ struct _MetaScreenCast
|
|||||||
GList *sessions;
|
GList *sessions;
|
||||||
|
|
||||||
MetaDbusSessionWatcher *session_watcher;
|
MetaDbusSessionWatcher *session_watcher;
|
||||||
|
MetaBackend *backend;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -62,12 +63,20 @@ meta_screen_cast_get_connection (MetaScreenCast *screen_cast)
|
|||||||
return g_dbus_interface_skeleton_get_connection (interface_skeleton);
|
return g_dbus_interface_skeleton_get_connection (interface_skeleton);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MetaBackend *
|
||||||
|
meta_screen_cast_get_backend (MetaScreenCast *screen_cast)
|
||||||
|
{
|
||||||
|
return screen_cast->backend;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
register_remote_desktop_screen_cast_session (MetaScreenCastSession *session,
|
register_remote_desktop_screen_cast_session (MetaScreenCastSession *session,
|
||||||
const char *remote_desktop_session_id,
|
const char *remote_desktop_session_id,
|
||||||
GError **error)
|
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);
|
MetaRemoteDesktop *remote_desktop = meta_backend_get_remote_desktop (backend);
|
||||||
MetaRemoteDesktopSession *remote_desktop_session;
|
MetaRemoteDesktopSession *remote_desktop_session;
|
||||||
|
|
||||||
@ -244,11 +253,13 @@ meta_screen_cast_finalize (GObject *object)
|
|||||||
}
|
}
|
||||||
|
|
||||||
MetaScreenCast *
|
MetaScreenCast *
|
||||||
meta_screen_cast_new (MetaDbusSessionWatcher *session_watcher)
|
meta_screen_cast_new (MetaBackend *backend,
|
||||||
|
MetaDbusSessionWatcher *session_watcher)
|
||||||
{
|
{
|
||||||
MetaScreenCast *screen_cast;
|
MetaScreenCast *screen_cast;
|
||||||
|
|
||||||
screen_cast = g_object_new (META_TYPE_SCREEN_CAST, NULL);
|
screen_cast = g_object_new (META_TYPE_SCREEN_CAST, NULL);
|
||||||
|
screen_cast->backend = backend;
|
||||||
screen_cast->session_watcher = session_watcher;
|
screen_cast->session_watcher = session_watcher;
|
||||||
|
|
||||||
return screen_cast;
|
return screen_cast;
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
|
|
||||||
|
#include "backends/meta-backend-private.h"
|
||||||
#include "backends/meta-dbus-session-watcher.h"
|
#include "backends/meta-dbus-session-watcher.h"
|
||||||
|
|
||||||
#include "meta-dbus-screen-cast.h"
|
#include "meta-dbus-screen-cast.h"
|
||||||
@ -36,6 +37,9 @@ G_DECLARE_FINAL_TYPE (MetaScreenCast, meta_screen_cast,
|
|||||||
|
|
||||||
GDBusConnection * meta_screen_cast_get_connection (MetaScreenCast *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 */
|
#endif /* META_SCREEN_CAST_H */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user