From 0160f3c0a0e031636bb11fff8693b2e0c760ed82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Mon, 28 Aug 2023 17:01:03 +0200 Subject: [PATCH] remote-desktop/session: Take over EIS context This means there will be an EIS context per session, which will enable per session devices and region. Part-of: --- src/backends/meta-backend-private.h | 2 -- src/backends/meta-backend.c | 14 -------------- src/backends/meta-eis.c | 6 ------ src/backends/meta-eis.h | 1 - src/backends/meta-remote-desktop-session.c | 12 +++++------- 5 files changed, 5 insertions(+), 30 deletions(-) diff --git a/src/backends/meta-backend-private.h b/src/backends/meta-backend-private.h index 592f85557..be6abc0ce 100644 --- a/src/backends/meta-backend-private.h +++ b/src/backends/meta-backend-private.h @@ -143,8 +143,6 @@ MetaDbusSessionWatcher * meta_backend_get_dbus_session_watcher (MetaBackend *bac MetaRemoteDesktop * meta_backend_get_remote_desktop (MetaBackend *backend); MetaScreenCast * meta_backend_get_screen_cast (MetaBackend *backend); - -MetaEis * meta_backend_get_eis (MetaBackend *backend); #endif MetaInputCapture * meta_backend_get_input_capture (MetaBackend *backend); diff --git a/src/backends/meta-backend.c b/src/backends/meta-backend.c index 904d2a89b..1a40caf53 100644 --- a/src/backends/meta-backend.c +++ b/src/backends/meta-backend.c @@ -78,7 +78,6 @@ #ifdef HAVE_REMOTE_DESKTOP #include "backends/meta-dbus-session-watcher.h" -#include "backends/meta-eis.h" #include "backends/meta-remote-access-controller-private.h" #include "backends/meta-remote-desktop.h" #include "backends/meta-screen-cast.h" @@ -140,7 +139,6 @@ struct _MetaBackendPrivate #ifdef HAVE_REMOTE_DESKTOP MetaScreenCast *screen_cast; MetaRemoteDesktop *remote_desktop; - MetaEis *eis; #endif MetaInputCapture *input_capture; @@ -210,7 +208,6 @@ meta_backend_dispose (GObject *object) #ifdef HAVE_REMOTE_DESKTOP g_clear_object (&priv->remote_desktop); g_clear_object (&priv->screen_cast); - g_clear_object (&priv->eis); #endif g_clear_object (&priv->input_capture); g_clear_object (&priv->dbus_session_watcher); @@ -584,7 +581,6 @@ meta_backend_real_post_init (MetaBackend *backend) meta_remote_access_controller_add ( priv->remote_access_controller, META_DBUS_SESSION_MANAGER (priv->remote_desktop)); - priv->eis = meta_eis_new (backend); #endif /* HAVE_REMOTE_DESKTOP */ priv->input_capture = meta_input_capture_new (backend); @@ -1443,16 +1439,6 @@ meta_backend_get_screen_cast (MetaBackend *backend) return priv->screen_cast; } - -/** - * meta_backend_get_eis: (skip) - */ -MetaEis * -meta_backend_get_eis (MetaBackend *backend) -{ - MetaBackendPrivate *priv = meta_backend_get_instance_private (backend); - return priv->eis; -} #endif /* HAVE_REMOTE_DESKTOP */ MetaInputCapture * diff --git a/src/backends/meta-eis.c b/src/backends/meta-eis.c index e6b35610b..45a11a6e1 100644 --- a/src/backends/meta-eis.c +++ b/src/backends/meta-eis.c @@ -56,12 +56,6 @@ meta_eis_get_backend (MetaEis *eis) return eis->backend; } -void -meta_eis_remove_all_clients (MetaEis *eis) -{ - g_hash_table_remove_all (eis->eis_clients); -} - static void meta_eis_remove_client (MetaEis *eis, struct eis_client *eis_client) diff --git a/src/backends/meta-eis.h b/src/backends/meta-eis.h index a2d0263e9..5b2f1c4fc 100644 --- a/src/backends/meta-eis.h +++ b/src/backends/meta-eis.h @@ -32,4 +32,3 @@ G_DECLARE_FINAL_TYPE (MetaEis, meta_eis, MetaEis * meta_eis_new (MetaBackend *backend); MetaBackend * meta_eis_get_backend (MetaEis *eis); int meta_eis_add_client_get_fd (MetaEis *eis); -void meta_eis_remove_all_clients (MetaEis *eis); diff --git a/src/backends/meta-remote-desktop-session.c b/src/backends/meta-remote-desktop-session.c index c9288d76c..90b4f6cd4 100644 --- a/src/backends/meta-remote-desktop-session.c +++ b/src/backends/meta-remote-desktop-session.c @@ -88,6 +88,7 @@ struct _MetaRemoteDesktopSession gulong screen_cast_session_closed_handler_id; guint started : 1; + MetaEis *eis; ClutterVirtualInputDevice *virtual_pointer; ClutterVirtualInputDevice *virtual_keyboard; ClutterVirtualInputDevice *virtual_touchscreen; @@ -223,8 +224,6 @@ meta_remote_desktop_session_close (MetaDbusSession *dbus_session) { MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (dbus_session); - MetaBackend *backend = - meta_dbus_session_manager_get_backend (session->session_manager); MetaDBusRemoteDesktopSession *skeleton = META_DBUS_REMOTE_DESKTOP_SESSION (session); @@ -244,6 +243,7 @@ meta_remote_desktop_session_close (MetaDbusSession *dbus_session) g_clear_object (&session->virtual_pointer); g_clear_object (&session->virtual_keyboard); g_clear_object (&session->virtual_touchscreen); + g_clear_object (&session->eis); meta_dbus_session_notify_closed (META_DBUS_SESSION (session)); meta_dbus_remote_desktop_session_emit_closed (skeleton); @@ -257,8 +257,6 @@ meta_remote_desktop_session_close (MetaDbusSession *dbus_session) meta_remote_access_handle_notify_stopped (remote_access_handle); } - meta_eis_remove_all_clients (meta_backend_get_eis (backend)); - g_object_unref (session); } @@ -1641,11 +1639,11 @@ handle_connect_to_eis (MetaDBusRemoteDesktopSession *skeleton, int fd_idx; GVariant *fd_variant; int fd; - MetaEis *meis; - meis = meta_backend_get_eis (backend); + if (!session->eis) + session->eis = meta_eis_new (backend); - fd = meta_eis_add_client_get_fd (meis); + fd = meta_eis_add_client_get_fd (session->eis); if (fd < 0) { g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,