|
|
776610 |
From 9fb08133fd89bb09dc6d4f202d9b76d43b42905e Mon Sep 17 00:00:00 2001
|
|
|
776610 |
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
|
|
776610 |
Date: Fri, 20 Jul 2018 16:37:37 +0200
|
|
|
776610 |
Subject: [PATCH] Add remote access controller API
|
|
|
776610 |
|
|
|
776610 |
Add API to let GNOME Shell have the ability to get notified about remote
|
|
|
776610 |
access sessions (remote desktop, remote control and screen cast), and
|
|
|
776610 |
with a way to close them.
|
|
|
776610 |
|
|
|
776610 |
This is done by adding an abstraction above the remote desktop and
|
|
|
776610 |
screen cast session objects, to avoid exposing their objects to outside
|
|
|
776610 |
of mutter. Doing that would result in external parts holding references
|
|
|
776610 |
to the objects, complicating their lifetimes. By using separate wrapper
|
|
|
776610 |
objects, we avoid this issue all together.
|
|
|
776610 |
---
|
|
|
776610 |
src/Makefile.am | 4 +
|
|
|
776610 |
src/backends/meta-backend.c | 23 ++++
|
|
|
776610 |
.../meta-remote-access-controller-private.h | 31 +++++
|
|
|
776610 |
src/backends/meta-remote-access-controller.c | 130 ++++++++++++++++++
|
|
|
776610 |
src/backends/meta-remote-desktop-session.c | 80 +++++++++++
|
|
|
776610 |
src/backends/meta-remote-desktop-session.h | 6 +
|
|
|
776610 |
src/backends/meta-screen-cast-session.c | 80 +++++++++++
|
|
|
776610 |
src/backends/meta-screen-cast-session.h | 7 +
|
|
|
776610 |
src/meta/meta-backend.h | 3 +
|
|
|
776610 |
src/meta/meta-remote-access-controller.h | 47 +++++++
|
|
|
776610 |
10 files changed, 411 insertions(+)
|
|
|
776610 |
create mode 100644 src/backends/meta-remote-access-controller-private.h
|
|
|
776610 |
create mode 100644 src/backends/meta-remote-access-controller.c
|
|
|
776610 |
create mode 100644 src/meta/meta-remote-access-controller.h
|
|
|
776610 |
|
|
|
776610 |
diff --git a/src/Makefile.am b/src/Makefile.am
|
|
|
776610 |
index 5bbac70e8d..aaf7c9c80d 100644
|
|
|
776610 |
--- a/src/Makefile.am
|
|
|
776610 |
+++ b/src/Makefile.am
|
|
|
776610 |
@@ -161,6 +161,9 @@ libmutter_@LIBMUTTER_API_VERSION@_la_SOURCES = \
|
|
|
776610 |
backends/meta-renderer.h \
|
|
|
776610 |
backends/meta-renderer-view.c \
|
|
|
776610 |
backends/meta-renderer-view.h \
|
|
|
776610 |
+ backends/meta-remote-access-controller.c \
|
|
|
776610 |
+ backends/meta-remote-access-controller-private.h \
|
|
|
776610 |
+ meta/meta-remote-access-controller.h \
|
|
|
776610 |
backends/edid-parse.c \
|
|
|
776610 |
backends/edid.h \
|
|
|
776610 |
backends/gsm-inhibitor-flag.h \
|
|
|
776610 |
@@ -546,6 +549,7 @@ libmutterinclude_headers = \
|
|
|
776610 |
meta/meta-idle-monitor.h \
|
|
|
776610 |
meta/meta-plugin.h \
|
|
|
776610 |
meta/meta-monitor-manager.h \
|
|
|
776610 |
+ meta/meta-remote-access-controller.h \
|
|
|
776610 |
meta/meta-settings.h \
|
|
|
776610 |
meta/meta-shaped-texture.h \
|
|
|
776610 |
meta/meta-shadow-factory.h \
|
|
|
776610 |
diff --git a/src/backends/meta-backend.c b/src/backends/meta-backend.c
|
|
|
776610 |
index 9348aa1bbd..888e51cd98 100644
|
|
|
776610 |
--- a/src/backends/meta-backend.c
|
|
|
776610 |
+++ b/src/backends/meta-backend.c
|
|
|
776610 |
@@ -39,6 +39,7 @@
|
|
|
776610 |
#ifdef HAVE_REMOTE_DESKTOP
|
|
|
776610 |
#include "backends/meta-dbus-session-watcher.h"
|
|
|
776610 |
#include "backends/meta-screen-cast.h"
|
|
|
776610 |
+#include "backends/meta-remote-access-controller-private.h"
|
|
|
776610 |
#include "backends/meta-remote-desktop.h"
|
|
|
776610 |
#endif
|
|
|
776610 |
|
|
|
776610 |
@@ -92,6 +93,7 @@ struct _MetaBackendPrivate
|
|
|
776610 |
MetaEgl *egl;
|
|
|
776610 |
MetaSettings *settings;
|
|
|
776610 |
#ifdef HAVE_REMOTE_DESKTOP
|
|
|
776610 |
+ MetaRemoteAccessController *remote_access_controller;
|
|
|
776610 |
MetaDbusSessionWatcher *dbus_session_watcher;
|
|
|
776610 |
MetaScreenCast *screen_cast;
|
|
|
776610 |
MetaRemoteDesktop *remote_desktop;
|
|
|
776610 |
@@ -139,6 +141,7 @@ meta_backend_finalize (GObject *object)
|
|
|
776610 |
g_clear_object (&priv->remote_desktop);
|
|
|
776610 |
g_clear_object (&priv->screen_cast);
|
|
|
776610 |
g_clear_object (&priv->dbus_session_watcher);
|
|
|
776610 |
+ g_clear_object (&priv->remote_access_controller);
|
|
|
776610 |
#endif
|
|
|
776610 |
|
|
|
776610 |
g_object_unref (priv->up_client);
|
|
|
776610 |
@@ -450,6 +453,8 @@ meta_backend_real_post_init (MetaBackend *backend)
|
|
|
776610 |
priv->input_settings = meta_backend_create_input_settings (backend);
|
|
|
776610 |
|
|
|
776610 |
#ifdef HAVE_REMOTE_DESKTOP
|
|
|
776610 |
+ priv->remote_access_controller =
|
|
|
776610 |
+ g_object_new (META_TYPE_REMOTE_ACCESS_CONTROLLER, NULL);
|
|
|
776610 |
priv->dbus_session_watcher = g_object_new (META_TYPE_DBUS_SESSION_WATCHER, NULL);
|
|
|
776610 |
priv->screen_cast = meta_screen_cast_new (priv->dbus_session_watcher);
|
|
|
776610 |
priv->remote_desktop = meta_remote_desktop_new (priv->dbus_session_watcher);
|
|
|
776610 |
@@ -777,6 +782,24 @@ meta_backend_get_remote_desktop (MetaBackend *backend)
|
|
|
776610 |
}
|
|
|
776610 |
#endif /* HAVE_REMOTE_DESKTOP */
|
|
|
776610 |
|
|
|
776610 |
+/**
|
|
|
776610 |
+ * meta_backend_get_remote_access_controller:
|
|
|
776610 |
+ * @backend: A #MetaBackend
|
|
|
776610 |
+ *
|
|
|
776610 |
+ * Return Value: (transfer none): The #MetaRemoteAccessController
|
|
|
776610 |
+ */
|
|
|
776610 |
+MetaRemoteAccessController *
|
|
|
776610 |
+meta_backend_get_remote_access_controller (MetaBackend *backend)
|
|
|
776610 |
+{
|
|
|
776610 |
+#ifdef HAVE_REMOTE_DESKTOP
|
|
|
776610 |
+ MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
|
|
|
776610 |
+
|
|
|
776610 |
+ return priv->remote_access_controller;
|
|
|
776610 |
+#else
|
|
|
776610 |
+ return NULL;
|
|
|
776610 |
+#endif
|
|
|
776610 |
+}
|
|
|
776610 |
+
|
|
|
776610 |
/**
|
|
|
776610 |
* meta_backend_grab_device: (skip)
|
|
|
776610 |
*/
|
|
|
776610 |
diff --git a/src/backends/meta-remote-access-controller-private.h b/src/backends/meta-remote-access-controller-private.h
|
|
|
776610 |
new file mode 100644
|
|
|
776610 |
index 0000000000..fce2082bfc
|
|
|
776610 |
--- /dev/null
|
|
|
776610 |
+++ b/src/backends/meta-remote-access-controller-private.h
|
|
|
776610 |
@@ -0,0 +1,31 @@
|
|
|
776610 |
+/*
|
|
|
776610 |
+ * Copyright (C) 2018 Red Hat Inc.
|
|
|
776610 |
+ *
|
|
|
776610 |
+ * This program is free software; you can redistribute it and/or
|
|
|
776610 |
+ * modify it under the terms of the GNU General Public License as
|
|
|
776610 |
+ * published by the Free Software Foundation; either version 2 of the
|
|
|
776610 |
+ * License, or (at your option) any later version.
|
|
|
776610 |
+ *
|
|
|
776610 |
+ * This program is distributed in the hope that it will be useful, but
|
|
|
776610 |
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
776610 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
776610 |
+ * General Public License for more details.
|
|
|
776610 |
+ *
|
|
|
776610 |
+ * You should have received a copy of the GNU General Public License
|
|
|
776610 |
+ * along with this program; if not, write to the Free Software
|
|
|
776610 |
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
|
776610 |
+ * 02111-1307, USA.
|
|
|
776610 |
+ *
|
|
|
776610 |
+ */
|
|
|
776610 |
+
|
|
|
776610 |
+#ifndef META_REMOTE_ACCESS_CONTROLLER_PRIVATE_H
|
|
|
776610 |
+#define META_REMOTE_ACCESS_CONTROLLER_PRIVATE_H
|
|
|
776610 |
+
|
|
|
776610 |
+#include "meta/meta-remote-access-controller.h"
|
|
|
776610 |
+
|
|
|
776610 |
+void meta_remote_access_controller_notify_new_handle (MetaRemoteAccessController *controller,
|
|
|
776610 |
+ MetaRemoteAccessHandle *handle);
|
|
|
776610 |
+
|
|
|
776610 |
+void meta_remote_access_handle_notify_stopped (MetaRemoteAccessHandle *handle);
|
|
|
776610 |
+
|
|
|
776610 |
+#endif /* META_REMOTE_ACCESS_CONTROLLER_PRIVATE_H */
|
|
|
776610 |
diff --git a/src/backends/meta-remote-access-controller.c b/src/backends/meta-remote-access-controller.c
|
|
|
776610 |
new file mode 100644
|
|
|
776610 |
index 0000000000..0e0ebe2bd8
|
|
|
776610 |
--- /dev/null
|
|
|
776610 |
+++ b/src/backends/meta-remote-access-controller.c
|
|
|
776610 |
@@ -0,0 +1,130 @@
|
|
|
776610 |
+/*
|
|
|
776610 |
+ * Copyright (C) 2018 Red Hat Inc.
|
|
|
776610 |
+ *
|
|
|
776610 |
+ * This program is free software; you can redistribute it and/or
|
|
|
776610 |
+ * modify it under the terms of the GNU General Public License as
|
|
|
776610 |
+ * published by the Free Software Foundation; either version 2 of the
|
|
|
776610 |
+ * License, or (at your option) any later version.
|
|
|
776610 |
+ *
|
|
|
776610 |
+ * This program is distributed in the hope that it will be useful, but
|
|
|
776610 |
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
776610 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
776610 |
+ * General Public License for more details.
|
|
|
776610 |
+ *
|
|
|
776610 |
+ * You should have received a copy of the GNU General Public License
|
|
|
776610 |
+ * along with this program; if not, write to the Free Software
|
|
|
776610 |
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
|
776610 |
+ * 02111-1307, USA.
|
|
|
776610 |
+ *
|
|
|
776610 |
+ */
|
|
|
776610 |
+
|
|
|
776610 |
+#include "config.h"
|
|
|
776610 |
+
|
|
|
776610 |
+#include "backends/meta-remote-access-controller-private.h"
|
|
|
776610 |
+
|
|
|
776610 |
+enum
|
|
|
776610 |
+{
|
|
|
776610 |
+ HANDLE_STOPPED,
|
|
|
776610 |
+
|
|
|
776610 |
+ N_HANDLE_SIGNALS
|
|
|
776610 |
+};
|
|
|
776610 |
+
|
|
|
776610 |
+static int handle_signals[N_HANDLE_SIGNALS];
|
|
|
776610 |
+
|
|
|
776610 |
+enum
|
|
|
776610 |
+{
|
|
|
776610 |
+ CONTROLLER_NEW_HANDLE,
|
|
|
776610 |
+
|
|
|
776610 |
+ N_CONTROLLER_SIGNALS
|
|
|
776610 |
+};
|
|
|
776610 |
+
|
|
|
776610 |
+static int controller_signals[N_CONTROLLER_SIGNALS];
|
|
|
776610 |
+
|
|
|
776610 |
+typedef struct _MetaRemoteAccessHandlePrivate
|
|
|
776610 |
+{
|
|
|
776610 |
+ gboolean has_stopped;
|
|
|
776610 |
+} MetaRemoteAccessHandlePrivate;
|
|
|
776610 |
+
|
|
|
776610 |
+G_DEFINE_TYPE_WITH_PRIVATE (MetaRemoteAccessHandle,
|
|
|
776610 |
+ meta_remote_access_handle,
|
|
|
776610 |
+ G_TYPE_OBJECT)
|
|
|
776610 |
+
|
|
|
776610 |
+struct _MetaRemoteAccessController
|
|
|
776610 |
+{
|
|
|
776610 |
+ GObject parent;
|
|
|
776610 |
+};
|
|
|
776610 |
+
|
|
|
776610 |
+G_DEFINE_TYPE (MetaRemoteAccessController,
|
|
|
776610 |
+ meta_remote_access_controller,
|
|
|
776610 |
+ G_TYPE_OBJECT)
|
|
|
776610 |
+
|
|
|
776610 |
+/**
|
|
|
776610 |
+ * meta_remote_access_handle_stop:
|
|
|
776610 |
+ * @handle: A #MetaRemoteAccessHandle
|
|
|
776610 |
+ *
|
|
|
776610 |
+ * Stop the associated remote access session.
|
|
|
776610 |
+ */
|
|
|
776610 |
+void
|
|
|
776610 |
+meta_remote_access_handle_stop (MetaRemoteAccessHandle *handle)
|
|
|
776610 |
+{
|
|
|
776610 |
+ MetaRemoteAccessHandlePrivate *priv =
|
|
|
776610 |
+ meta_remote_access_handle_get_instance_private (handle);
|
|
|
776610 |
+
|
|
|
776610 |
+ if (priv->has_stopped)
|
|
|
776610 |
+ return;
|
|
|
776610 |
+
|
|
|
776610 |
+ META_REMOTE_ACCESS_HANDLE_GET_CLASS (handle)->stop (handle);
|
|
|
776610 |
+}
|
|
|
776610 |
+
|
|
|
776610 |
+void
|
|
|
776610 |
+meta_remote_access_handle_notify_stopped (MetaRemoteAccessHandle *handle)
|
|
|
776610 |
+{
|
|
|
776610 |
+ MetaRemoteAccessHandlePrivate *priv =
|
|
|
776610 |
+ meta_remote_access_handle_get_instance_private (handle);
|
|
|
776610 |
+
|
|
|
776610 |
+ priv->has_stopped = TRUE;
|
|
|
776610 |
+ g_signal_emit (handle, handle_signals[HANDLE_STOPPED], 0);
|
|
|
776610 |
+}
|
|
|
776610 |
+
|
|
|
776610 |
+void
|
|
|
776610 |
+meta_remote_access_controller_notify_new_handle (MetaRemoteAccessController *controller,
|
|
|
776610 |
+ MetaRemoteAccessHandle *handle)
|
|
|
776610 |
+{
|
|
|
776610 |
+ g_signal_emit (controller, controller_signals[CONTROLLER_NEW_HANDLE], 0,
|
|
|
776610 |
+ handle);
|
|
|
776610 |
+}
|
|
|
776610 |
+
|
|
|
776610 |
+static void
|
|
|
776610 |
+meta_remote_access_handle_init (MetaRemoteAccessHandle *handle)
|
|
|
776610 |
+{
|
|
|
776610 |
+}
|
|
|
776610 |
+
|
|
|
776610 |
+static void
|
|
|
776610 |
+meta_remote_access_handle_class_init (MetaRemoteAccessHandleClass *klass)
|
|
|
776610 |
+{
|
|
|
776610 |
+ handle_signals[HANDLE_STOPPED] =
|
|
|
776610 |
+ g_signal_new ("stopped",
|
|
|
776610 |
+ G_TYPE_FROM_CLASS (klass),
|
|
|
776610 |
+ G_SIGNAL_RUN_LAST,
|
|
|
776610 |
+ 0,
|
|
|
776610 |
+ NULL, NULL, NULL,
|
|
|
776610 |
+ G_TYPE_NONE, 0);
|
|
|
776610 |
+}
|
|
|
776610 |
+
|
|
|
776610 |
+static void
|
|
|
776610 |
+meta_remote_access_controller_init (MetaRemoteAccessController *controller)
|
|
|
776610 |
+{
|
|
|
776610 |
+}
|
|
|
776610 |
+
|
|
|
776610 |
+static void
|
|
|
776610 |
+meta_remote_access_controller_class_init (MetaRemoteAccessControllerClass *klass)
|
|
|
776610 |
+{
|
|
|
776610 |
+ controller_signals[CONTROLLER_NEW_HANDLE] =
|
|
|
776610 |
+ g_signal_new ("new-handle",
|
|
|
776610 |
+ G_TYPE_FROM_CLASS (klass),
|
|
|
776610 |
+ G_SIGNAL_RUN_LAST,
|
|
|
776610 |
+ 0,
|
|
|
776610 |
+ NULL, NULL, NULL,
|
|
|
776610 |
+ G_TYPE_NONE, 1,
|
|
|
776610 |
+ META_TYPE_REMOTE_ACCESS_HANDLE);
|
|
|
776610 |
+}
|
|
|
776610 |
diff --git a/src/backends/meta-remote-desktop-session.c b/src/backends/meta-remote-desktop-session.c
|
|
|
776610 |
index 821b16724f..73bcf663be 100644
|
|
|
776610 |
--- a/src/backends/meta-remote-desktop-session.c
|
|
|
776610 |
+++ b/src/backends/meta-remote-desktop-session.c
|
|
|
776610 |
@@ -30,6 +30,7 @@
|
|
|
776610 |
|
|
|
776610 |
#include "backends/meta-dbus-session-watcher.h"
|
|
|
776610 |
#include "backends/meta-screen-cast-session.h"
|
|
|
776610 |
+#include "backends/meta-remote-access-controller-private.h"
|
|
|
776610 |
#include "backends/native/meta-backend-native.h"
|
|
|
776610 |
#include "backends/x11/meta-backend-x11.h"
|
|
|
776610 |
#include "cogl/cogl.h"
|
|
|
776610 |
@@ -59,6 +60,8 @@ struct _MetaRemoteDesktopSession
|
|
|
776610 |
ClutterVirtualInputDevice *virtual_pointer;
|
|
|
776610 |
ClutterVirtualInputDevice *virtual_keyboard;
|
|
|
776610 |
ClutterVirtualInputDevice *virtual_touchscreen;
|
|
|
776610 |
+
|
|
|
776610 |
+ MetaRemoteDesktopSessionHandle *handle;
|
|
|
776610 |
};
|
|
|
776610 |
|
|
|
776610 |
static void
|
|
|
776610 |
@@ -75,12 +78,41 @@ G_DEFINE_TYPE_WITH_CODE (MetaRemoteDesktopSession,
|
|
|
776610 |
G_IMPLEMENT_INTERFACE (META_TYPE_DBUS_SESSION,
|
|
|
776610 |
meta_dbus_session_init_iface))
|
|
|
776610 |
|
|
|
776610 |
+struct _MetaRemoteDesktopSessionHandle
|
|
|
776610 |
+{
|
|
|
776610 |
+ MetaRemoteAccessHandle parent;
|
|
|
776610 |
+
|
|
|
776610 |
+ MetaRemoteDesktopSession *session;
|
|
|
776610 |
+};
|
|
|
776610 |
+
|
|
|
776610 |
+G_DEFINE_TYPE (MetaRemoteDesktopSessionHandle,
|
|
|
776610 |
+ meta_remote_desktop_session_handle,
|
|
|
776610 |
+ META_TYPE_REMOTE_ACCESS_HANDLE)
|
|
|
776610 |
+
|
|
|
776610 |
+static MetaRemoteDesktopSessionHandle *
|
|
|
776610 |
+meta_remote_desktop_session_handle_new (MetaRemoteDesktopSession *session);
|
|
|
776610 |
+
|
|
|
776610 |
static gboolean
|
|
|
776610 |
meta_remote_desktop_session_is_running (MetaRemoteDesktopSession *session)
|
|
|
776610 |
{
|
|
|
776610 |
return !!session->virtual_pointer;
|
|
|
776610 |
}
|
|
|
776610 |
|
|
|
776610 |
+static void
|
|
|
776610 |
+init_remote_access_handle (MetaRemoteDesktopSession *session)
|
|
|
776610 |
+{
|
|
|
776610 |
+ MetaBackend *backend = meta_get_backend ();
|
|
|
776610 |
+ MetaRemoteAccessController *remote_access_controller;
|
|
|
776610 |
+ MetaRemoteAccessHandle *remote_access_handle;
|
|
|
776610 |
+
|
|
|
776610 |
+ session->handle = meta_remote_desktop_session_handle_new (session);
|
|
|
776610 |
+
|
|
|
776610 |
+ remote_access_controller = meta_backend_get_remote_access_controller (backend);
|
|
|
776610 |
+ remote_access_handle = META_REMOTE_ACCESS_HANDLE (session->handle);
|
|
|
776610 |
+ meta_remote_access_controller_notify_new_handle (remote_access_controller,
|
|
|
776610 |
+ remote_access_handle);
|
|
|
776610 |
+}
|
|
|
776610 |
+
|
|
|
776610 |
static gboolean
|
|
|
776610 |
meta_remote_desktop_session_start (MetaRemoteDesktopSession *session,
|
|
|
776610 |
GError **error)
|
|
|
776610 |
@@ -107,6 +139,8 @@ meta_remote_desktop_session_start (MetaRemoteDesktopSession *session,
|
|
|
776610 |
clutter_device_manager_create_virtual_device (device_manager,
|
|
|
776610 |
CLUTTER_TOUCHSCREEN_DEVICE);
|
|
|
776610 |
|
|
|
776610 |
+ init_remote_access_handle (session);
|
|
|
776610 |
+
|
|
|
776610 |
return TRUE;
|
|
|
776610 |
}
|
|
|
776610 |
|
|
|
776610 |
@@ -131,6 +165,14 @@ meta_remote_desktop_session_close (MetaRemoteDesktopSession *session)
|
|
|
776610 |
meta_dbus_remote_desktop_session_emit_closed (skeleton);
|
|
|
776610 |
g_dbus_interface_skeleton_unexport (G_DBUS_INTERFACE_SKELETON (session));
|
|
|
776610 |
|
|
|
776610 |
+ if (session->handle)
|
|
|
776610 |
+ {
|
|
|
776610 |
+ MetaRemoteAccessHandle *remote_access_handle =
|
|
|
776610 |
+ META_REMOTE_ACCESS_HANDLE (session->handle);
|
|
|
776610 |
+
|
|
|
776610 |
+ meta_remote_access_handle_notify_stopped (remote_access_handle);
|
|
|
776610 |
+ }
|
|
|
776610 |
+
|
|
|
776610 |
g_object_unref (session);
|
|
|
776610 |
}
|
|
|
776610 |
|
|
|
776610 |
@@ -729,6 +771,7 @@ meta_remote_desktop_session_finalize (GObject *object)
|
|
|
776610 |
|
|
|
776610 |
g_assert (!meta_remote_desktop_session_is_running (session));
|
|
|
776610 |
|
|
|
776610 |
+ g_clear_object (&session->handle);
|
|
|
776610 |
g_free (session->peer_name);
|
|
|
776610 |
g_free (session->session_id);
|
|
|
776610 |
g_free (session->object_path);
|
|
|
776610 |
@@ -763,3 +806,40 @@ meta_remote_desktop_session_class_init (MetaRemoteDesktopSessionClass *klass)
|
|
|
776610 |
|
|
|
776610 |
object_class->finalize = meta_remote_desktop_session_finalize;
|
|
|
776610 |
}
|
|
|
776610 |
+
|
|
|
776610 |
+static MetaRemoteDesktopSessionHandle *
|
|
|
776610 |
+meta_remote_desktop_session_handle_new (MetaRemoteDesktopSession *session)
|
|
|
776610 |
+{
|
|
|
776610 |
+ MetaRemoteDesktopSessionHandle *handle;
|
|
|
776610 |
+
|
|
|
776610 |
+ handle = g_object_new (META_TYPE_REMOTE_DESKTOP_SESSION_HANDLE, NULL);
|
|
|
776610 |
+ handle->session = session;
|
|
|
776610 |
+
|
|
|
776610 |
+ return handle;
|
|
|
776610 |
+}
|
|
|
776610 |
+
|
|
|
776610 |
+static void
|
|
|
776610 |
+meta_remote_desktop_session_handle_stop (MetaRemoteAccessHandle *handle)
|
|
|
776610 |
+{
|
|
|
776610 |
+ MetaRemoteDesktopSession *session;
|
|
|
776610 |
+
|
|
|
776610 |
+ session = META_REMOTE_DESKTOP_SESSION_HANDLE (handle)->session;
|
|
|
776610 |
+ if (!session)
|
|
|
776610 |
+ return;
|
|
|
776610 |
+
|
|
|
776610 |
+ meta_remote_desktop_session_close (session);
|
|
|
776610 |
+}
|
|
|
776610 |
+
|
|
|
776610 |
+static void
|
|
|
776610 |
+meta_remote_desktop_session_handle_init (MetaRemoteDesktopSessionHandle *handle)
|
|
|
776610 |
+{
|
|
|
776610 |
+}
|
|
|
776610 |
+
|
|
|
776610 |
+static void
|
|
|
776610 |
+meta_remote_desktop_session_handle_class_init (MetaRemoteDesktopSessionHandleClass *klass)
|
|
|
776610 |
+{
|
|
|
776610 |
+ MetaRemoteAccessHandleClass *remote_access_handle_class =
|
|
|
776610 |
+ META_REMOTE_ACCESS_HANDLE_CLASS (klass);
|
|
|
776610 |
+
|
|
|
776610 |
+ remote_access_handle_class->stop = meta_remote_desktop_session_handle_stop;
|
|
|
776610 |
+}
|
|
|
776610 |
diff --git a/src/backends/meta-remote-desktop-session.h b/src/backends/meta-remote-desktop-session.h
|
|
|
776610 |
index 54dce41190..1edb3739b1 100644
|
|
|
776610 |
--- a/src/backends/meta-remote-desktop-session.h
|
|
|
776610 |
+++ b/src/backends/meta-remote-desktop-session.h
|
|
|
776610 |
@@ -33,6 +33,12 @@ G_DECLARE_FINAL_TYPE (MetaRemoteDesktopSession, meta_remote_desktop_session,
|
|
|
776610 |
META, REMOTE_DESKTOP_SESSION,
|
|
|
776610 |
MetaDBusRemoteDesktopSessionSkeleton)
|
|
|
776610 |
|
|
|
776610 |
+#define META_TYPE_REMOTE_DESKTOP_SESSION_HANDLE (meta_remote_desktop_session_handle_get_type ())
|
|
|
776610 |
+G_DECLARE_FINAL_TYPE (MetaRemoteDesktopSessionHandle,
|
|
|
776610 |
+ meta_remote_desktop_session_handle,
|
|
|
776610 |
+ META, REMOTE_DESKTOP_SESSION_HANDLE,
|
|
|
776610 |
+ MetaRemoteAccessHandle)
|
|
|
776610 |
+
|
|
|
776610 |
char * meta_remote_desktop_session_get_object_path (MetaRemoteDesktopSession *session);
|
|
|
776610 |
|
|
|
776610 |
char * meta_remote_desktop_session_get_session_id (MetaRemoteDesktopSession *session);
|
|
|
776610 |
diff --git a/src/backends/meta-screen-cast-session.c b/src/backends/meta-screen-cast-session.c
|
|
|
776610 |
index b95ce514dc..e1b6393e8f 100644
|
|
|
776610 |
--- a/src/backends/meta-screen-cast-session.c
|
|
|
776610 |
+++ b/src/backends/meta-screen-cast-session.c
|
|
|
776610 |
@@ -28,6 +28,7 @@
|
|
|
776610 |
#include "backends/meta-dbus-session-watcher.h"
|
|
|
776610 |
#include "backends/meta-screen-cast-monitor-stream.h"
|
|
|
776610 |
#include "backends/meta-screen-cast-stream.h"
|
|
|
776610 |
+#include "backends/meta-remote-access-controller-private.h"
|
|
|
776610 |
|
|
|
776610 |
#define META_SCREEN_CAST_SESSION_DBUS_PATH "/org/gnome/Mutter/ScreenCast/Session"
|
|
|
776610 |
|
|
|
776610 |
@@ -41,6 +42,8 @@ struct _MetaScreenCastSession
|
|
|
776610 |
char *object_path;
|
|
|
776610 |
|
|
|
776610 |
GList *streams;
|
|
|
776610 |
+
|
|
|
776610 |
+ MetaScreenCastSessionHandle *handle;
|
|
|
776610 |
};
|
|
|
776610 |
|
|
|
776610 |
static void
|
|
|
776610 |
@@ -57,6 +60,35 @@ G_DEFINE_TYPE_WITH_CODE (MetaScreenCastSession,
|
|
|
776610 |
G_IMPLEMENT_INTERFACE (META_TYPE_DBUS_SESSION,
|
|
|
776610 |
meta_dbus_session_init_iface))
|
|
|
776610 |
|
|
|
776610 |
+struct _MetaScreenCastSessionHandle
|
|
|
776610 |
+{
|
|
|
776610 |
+ MetaRemoteAccessHandle parent;
|
|
|
776610 |
+
|
|
|
776610 |
+ MetaScreenCastSession *session;
|
|
|
776610 |
+};
|
|
|
776610 |
+
|
|
|
776610 |
+G_DEFINE_TYPE (MetaScreenCastSessionHandle,
|
|
|
776610 |
+ meta_screen_cast_session_handle,
|
|
|
776610 |
+ META_TYPE_REMOTE_ACCESS_HANDLE)
|
|
|
776610 |
+
|
|
|
776610 |
+static MetaScreenCastSessionHandle *
|
|
|
776610 |
+meta_screen_cast_session_handle_new (MetaScreenCastSession *session);
|
|
|
776610 |
+
|
|
|
776610 |
+static void
|
|
|
776610 |
+init_remote_access_handle (MetaScreenCastSession *session)
|
|
|
776610 |
+{
|
|
|
776610 |
+ MetaBackend *backend = meta_get_backend ();
|
|
|
776610 |
+ MetaRemoteAccessController *remote_access_controller;
|
|
|
776610 |
+ MetaRemoteAccessHandle *remote_access_handle;
|
|
|
776610 |
+
|
|
|
776610 |
+ session->handle = meta_screen_cast_session_handle_new (session);
|
|
|
776610 |
+
|
|
|
776610 |
+ remote_access_controller = meta_backend_get_remote_access_controller (backend);
|
|
|
776610 |
+ remote_access_handle = META_REMOTE_ACCESS_HANDLE (session->handle);
|
|
|
776610 |
+ meta_remote_access_controller_notify_new_handle (remote_access_controller,
|
|
|
776610 |
+ remote_access_handle);
|
|
|
776610 |
+}
|
|
|
776610 |
+
|
|
|
776610 |
gboolean
|
|
|
776610 |
meta_screen_cast_session_start (MetaScreenCastSession *session,
|
|
|
776610 |
GError **error)
|
|
|
776610 |
@@ -71,6 +103,8 @@ meta_screen_cast_session_start (MetaScreenCastSession *session,
|
|
|
776610 |
return FALSE;
|
|
|
776610 |
}
|
|
|
776610 |
|
|
|
776610 |
+ init_remote_access_handle (session);
|
|
|
776610 |
+
|
|
|
776610 |
return TRUE;
|
|
|
776610 |
}
|
|
|
776610 |
|
|
|
776610 |
@@ -94,6 +128,14 @@ meta_screen_cast_session_close (MetaScreenCastSession *session)
|
|
|
776610 |
|
|
|
776610 |
g_dbus_interface_skeleton_unexport (G_DBUS_INTERFACE_SKELETON (session));
|
|
|
776610 |
|
|
|
776610 |
+ if (session->handle)
|
|
|
776610 |
+ {
|
|
|
776610 |
+ MetaRemoteAccessHandle *remote_access_handle =
|
|
|
776610 |
+ META_REMOTE_ACCESS_HANDLE (session->handle);
|
|
|
776610 |
+
|
|
|
776610 |
+ meta_remote_access_handle_notify_stopped (remote_access_handle);
|
|
|
776610 |
+ }
|
|
|
776610 |
+
|
|
|
776610 |
g_object_unref (session);
|
|
|
776610 |
}
|
|
|
776610 |
|
|
|
776610 |
@@ -361,6 +403,7 @@ meta_screen_cast_session_finalize (GObject *object)
|
|
|
776610 |
{
|
|
|
776610 |
MetaScreenCastSession *session = META_SCREEN_CAST_SESSION (object);
|
|
|
776610 |
|
|
|
776610 |
+ g_clear_object (&session->handle);
|
|
|
776610 |
g_free (session->peer_name);
|
|
|
776610 |
g_free (session->object_path);
|
|
|
776610 |
|
|
|
776610 |
@@ -379,3 +422,40 @@ meta_screen_cast_session_class_init (MetaScreenCastSessionClass *klass)
|
|
|
776610 |
|
|
|
776610 |
object_class->finalize = meta_screen_cast_session_finalize;
|
|
|
776610 |
}
|
|
|
776610 |
+
|
|
|
776610 |
+static MetaScreenCastSessionHandle *
|
|
|
776610 |
+meta_screen_cast_session_handle_new (MetaScreenCastSession *session)
|
|
|
776610 |
+{
|
|
|
776610 |
+ MetaScreenCastSessionHandle *handle;
|
|
|
776610 |
+
|
|
|
776610 |
+ handle = g_object_new (META_TYPE_SCREEN_CAST_SESSION_HANDLE, NULL);
|
|
|
776610 |
+ handle->session = session;
|
|
|
776610 |
+
|
|
|
776610 |
+ return handle;
|
|
|
776610 |
+}
|
|
|
776610 |
+
|
|
|
776610 |
+static void
|
|
|
776610 |
+meta_screen_cast_session_handle_stop (MetaRemoteAccessHandle *handle)
|
|
|
776610 |
+{
|
|
|
776610 |
+ MetaScreenCastSession *session;
|
|
|
776610 |
+
|
|
|
776610 |
+ session = META_SCREEN_CAST_SESSION_HANDLE (handle)->session;
|
|
|
776610 |
+ if (!session)
|
|
|
776610 |
+ return;
|
|
|
776610 |
+
|
|
|
776610 |
+ meta_screen_cast_session_close (session);
|
|
|
776610 |
+}
|
|
|
776610 |
+
|
|
|
776610 |
+static void
|
|
|
776610 |
+meta_screen_cast_session_handle_init (MetaScreenCastSessionHandle *handle)
|
|
|
776610 |
+{
|
|
|
776610 |
+}
|
|
|
776610 |
+
|
|
|
776610 |
+static void
|
|
|
776610 |
+meta_screen_cast_session_handle_class_init (MetaScreenCastSessionHandleClass *klass)
|
|
|
776610 |
+{
|
|
|
776610 |
+ MetaRemoteAccessHandleClass *remote_access_handle_class =
|
|
|
776610 |
+ META_REMOTE_ACCESS_HANDLE_CLASS (klass);
|
|
|
776610 |
+
|
|
|
776610 |
+ remote_access_handle_class->stop = meta_screen_cast_session_handle_stop;
|
|
|
776610 |
+}
|
|
|
776610 |
diff --git a/src/backends/meta-screen-cast-session.h b/src/backends/meta-screen-cast-session.h
|
|
|
776610 |
index c877912cf9..ac0a31a165 100644
|
|
|
776610 |
--- a/src/backends/meta-screen-cast-session.h
|
|
|
776610 |
+++ b/src/backends/meta-screen-cast-session.h
|
|
|
776610 |
@@ -26,6 +26,7 @@
|
|
|
776610 |
#include "backends/meta-screen-cast.h"
|
|
|
776610 |
|
|
|
776610 |
#include "backends/meta-screen-cast-stream.h"
|
|
|
776610 |
+#include "meta/meta-remote-access-controller.h"
|
|
|
776610 |
|
|
|
776610 |
typedef enum _MetaScreenCastSessionType
|
|
|
776610 |
{
|
|
|
776610 |
@@ -38,6 +39,12 @@ G_DECLARE_FINAL_TYPE (MetaScreenCastSession, meta_screen_cast_session,
|
|
|
776610 |
META, SCREEN_CAST_SESSION,
|
|
|
776610 |
MetaDBusScreenCastSessionSkeleton)
|
|
|
776610 |
|
|
|
776610 |
+#define META_TYPE_SCREEN_CAST_SESSION_HANDLE (meta_screen_cast_session_handle_get_type ())
|
|
|
776610 |
+G_DECLARE_FINAL_TYPE (MetaScreenCastSessionHandle,
|
|
|
776610 |
+ meta_screen_cast_session_handle,
|
|
|
776610 |
+ META, SCREEN_CAST_SESSION_HANDLE,
|
|
|
776610 |
+ MetaRemoteAccessHandle)
|
|
|
776610 |
+
|
|
|
776610 |
char * meta_screen_cast_session_get_object_path (MetaScreenCastSession *session);
|
|
|
776610 |
|
|
|
776610 |
MetaScreenCastSession * meta_screen_cast_session_new (MetaScreenCast *screen_cast,
|
|
|
776610 |
diff --git a/src/meta/meta-backend.h b/src/meta/meta-backend.h
|
|
|
776610 |
index 8db2360ccd..0e5947dc12 100644
|
|
|
776610 |
--- a/src/meta/meta-backend.h
|
|
|
776610 |
+++ b/src/meta/meta-backend.h
|
|
|
776610 |
@@ -29,6 +29,7 @@
|
|
|
776610 |
|
|
|
776610 |
#include <clutter/clutter.h>
|
|
|
776610 |
#include "meta/meta-dnd.h"
|
|
|
776610 |
+#include "meta/meta-remote-access-controller.h"
|
|
|
776610 |
|
|
|
776610 |
typedef struct _MetaBackend MetaBackend;
|
|
|
776610 |
typedef struct _MetaBackendClass MetaBackendClass;
|
|
|
776610 |
@@ -54,6 +55,8 @@ MetaDnd *meta_backend_get_dnd (MetaBackend *backend);
|
|
|
776610 |
|
|
|
776610 |
MetaSettings *meta_backend_get_settings (MetaBackend *backend);
|
|
|
776610 |
|
|
|
776610 |
+MetaRemoteAccessController * meta_backend_get_remote_access_controller (MetaBackend *backend);
|
|
|
776610 |
+
|
|
|
776610 |
void meta_clutter_init (void);
|
|
|
776610 |
|
|
|
776610 |
#endif /* META_BACKEND_H */
|
|
|
776610 |
diff --git a/src/meta/meta-remote-access-controller.h b/src/meta/meta-remote-access-controller.h
|
|
|
776610 |
new file mode 100644
|
|
|
776610 |
index 0000000000..1b66f518c7
|
|
|
776610 |
--- /dev/null
|
|
|
776610 |
+++ b/src/meta/meta-remote-access-controller.h
|
|
|
776610 |
@@ -0,0 +1,47 @@
|
|
|
776610 |
+/*
|
|
|
776610 |
+ * Copyright (C) 2018 Red Hat Inc.
|
|
|
776610 |
+ *
|
|
|
776610 |
+ * This program is free software; you can redistribute it and/or
|
|
|
776610 |
+ * modify it under the terms of the GNU General Public License as
|
|
|
776610 |
+ * published by the Free Software Foundation; either version 2 of the
|
|
|
776610 |
+ * License, or (at your option) any later version.
|
|
|
776610 |
+ *
|
|
|
776610 |
+ * This program is distributed in the hope that it will be useful, but
|
|
|
776610 |
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
776610 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
776610 |
+ * General Public License for more details.
|
|
|
776610 |
+ *
|
|
|
776610 |
+ * You should have received a copy of the GNU General Public License
|
|
|
776610 |
+ * along with this program; if not, write to the Free Software
|
|
|
776610 |
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
|
776610 |
+ * 02111-1307, USA.
|
|
|
776610 |
+ *
|
|
|
776610 |
+ */
|
|
|
776610 |
+
|
|
|
776610 |
+#ifndef META_REMOTE_ACCESS_CONTROLLER_H
|
|
|
776610 |
+#define META_REMOTE_ACCESS_CONTROLLER_H
|
|
|
776610 |
+
|
|
|
776610 |
+#include <glib-object.h>
|
|
|
776610 |
+
|
|
|
776610 |
+#define META_TYPE_REMOTE_ACCESS_HANDLE meta_remote_access_handle_get_type ()
|
|
|
776610 |
+G_DECLARE_DERIVABLE_TYPE (MetaRemoteAccessHandle,
|
|
|
776610 |
+ meta_remote_access_handle,
|
|
|
776610 |
+ META, REMOTE_ACCESS_HANDLE,
|
|
|
776610 |
+ GObject)
|
|
|
776610 |
+
|
|
|
776610 |
+struct _MetaRemoteAccessHandleClass
|
|
|
776610 |
+{
|
|
|
776610 |
+ GObjectClass parent_class;
|
|
|
776610 |
+
|
|
|
776610 |
+ void (*stop) (MetaRemoteAccessHandle *handle);
|
|
|
776610 |
+};
|
|
|
776610 |
+
|
|
|
776610 |
+void meta_remote_access_handle_stop (MetaRemoteAccessHandle *handle);
|
|
|
776610 |
+
|
|
|
776610 |
+#define META_TYPE_REMOTE_ACCESS_CONTROLLER meta_remote_access_controller_get_type ()
|
|
|
776610 |
+G_DECLARE_FINAL_TYPE (MetaRemoteAccessController,
|
|
|
776610 |
+ meta_remote_access_controller,
|
|
|
776610 |
+ META, REMOTE_ACCESS_CONTROLLER,
|
|
|
776610 |
+ GObject)
|
|
|
776610 |
+
|
|
|
776610 |
+#endif /* META_REMOTE_ACCESS_CONTROLLER_H */
|
|
|
776610 |
--
|
|
|
776610 |
2.17.1
|
|
|
776610 |
|