From 0f59b6f55b672b3f957edbcd2034eaf5fc047ea5 Mon Sep 17 00:00:00 2001 From: Joan Torres Date: Thu, 11 Aug 2022 16:32:24 +0200 Subject: [PATCH 1/2] dbus: Add prefix Mutter to dbus names Add the prefix Mutter to RemoteDesktop and ScreenCast dbus names to specify they are Mutter dbus objects differentiating them from a not Mutter RemoteDesktop dbus object. --- src/grd-context.c | 40 +++---- src/grd-context.h | 16 +-- src/grd-daemon.c | 118 +++++++++---------- src/grd-daemon.h | 4 +- src/grd-session.c | 290 +++++++++++++++++++++++----------------------- src/grd-stream.c | 12 +- src/grd-stream.h | 6 +- src/meson.build | 8 +- 8 files changed, 247 insertions(+), 247 deletions(-) diff --git a/src/grd-context.c b/src/grd-context.c index f57b0438..f3a9cf9e 100644 --- a/src/grd-context.c +++ b/src/grd-context.c @@ -30,15 +30,15 @@ #include "grd-egl-thread.h" #include "grd-settings.h" -#include "grd-dbus-remote-desktop.h" -#include "grd-dbus-screen-cast.h" +#include "grd-dbus-mutter-remote-desktop.h" +#include "grd-dbus-mutter-screen-cast.h" struct _GrdContext { GObject parent; - GrdDBusRemoteDesktop *remote_desktop_proxy; - GrdDBusScreenCast *screen_cast_proxy; + GrdDBusMutterRemoteDesktop *mutter_remote_desktop_proxy; + GrdDBusMutterScreenCast *mutter_screen_cast_proxy; GrdEglThread *egl_thread; @@ -48,32 +48,32 @@ struct _GrdContext G_DEFINE_TYPE (GrdContext, grd_context, G_TYPE_OBJECT) -GrdDBusRemoteDesktop * -grd_context_get_remote_desktop_proxy (GrdContext *context) +GrdDBusMutterRemoteDesktop * +grd_context_get_mutter_remote_desktop_proxy (GrdContext *context) { - return context->remote_desktop_proxy; + return context->mutter_remote_desktop_proxy; } -GrdDBusScreenCast * -grd_context_get_screen_cast_proxy (GrdContext *context) +GrdDBusMutterScreenCast * +grd_context_get_mutter_screen_cast_proxy (GrdContext *context) { - return context->screen_cast_proxy; + return context->mutter_screen_cast_proxy; } void -grd_context_set_remote_desktop_proxy (GrdContext *context, - GrdDBusRemoteDesktop *proxy) +grd_context_set_mutter_remote_desktop_proxy (GrdContext *context, + GrdDBusMutterRemoteDesktop *proxy) { - g_clear_object (&context->remote_desktop_proxy); - context->remote_desktop_proxy = proxy; + g_clear_object (&context->mutter_remote_desktop_proxy); + context->mutter_remote_desktop_proxy = proxy; } void -grd_context_set_screen_cast_proxy (GrdContext *context, - GrdDBusScreenCast *proxy) +grd_context_set_mutter_screen_cast_proxy (GrdContext *context, + GrdDBusMutterScreenCast *proxy) { - g_clear_object (&context->screen_cast_proxy); - context->screen_cast_proxy = proxy; + g_clear_object (&context->mutter_screen_cast_proxy); + context->mutter_screen_cast_proxy = proxy; } GrdSettings * @@ -146,8 +146,8 @@ grd_context_finalize (GObject *object) { GrdContext *context = GRD_CONTEXT (object); - g_clear_object (&context->remote_desktop_proxy); - g_clear_object (&context->screen_cast_proxy); + g_clear_object (&context->mutter_remote_desktop_proxy); + g_clear_object (&context->mutter_screen_cast_proxy); g_clear_pointer (&context->egl_thread, grd_egl_thread_free); g_clear_object (&context->settings); g_clear_object (&context->credentials); diff --git a/src/grd-context.h b/src/grd-context.h index 4d6f63c7..21716d9d 100644 --- a/src/grd-context.h +++ b/src/grd-context.h @@ -25,8 +25,8 @@ #include -#include "grd-dbus-remote-desktop.h" -#include "grd-dbus-screen-cast.h" +#include "grd-dbus-mutter-remote-desktop.h" +#include "grd-dbus-mutter-screen-cast.h" #include "grd-settings.h" #include "grd-types.h" @@ -42,15 +42,15 @@ G_DECLARE_FINAL_TYPE (GrdContext, grd_context, GRD, CONTEXT, GObject) GrdContext * grd_context_new (GrdRuntimeMode runtime_mode, GError **error); -GrdDBusRemoteDesktop * grd_context_get_remote_desktop_proxy (GrdContext *context); +GrdDBusMutterRemoteDesktop * grd_context_get_mutter_remote_desktop_proxy (GrdContext *context); -GrdDBusScreenCast * grd_context_get_screen_cast_proxy (GrdContext *context); +GrdDBusMutterScreenCast * grd_context_get_mutter_screen_cast_proxy (GrdContext *context); -void grd_context_set_remote_desktop_proxy (GrdContext *context, - GrdDBusRemoteDesktop *proxy); +void grd_context_set_mutter_remote_desktop_proxy (GrdContext *context, + GrdDBusMutterRemoteDesktop *proxy); -void grd_context_set_screen_cast_proxy (GrdContext *context, - GrdDBusScreenCast *proxy); +void grd_context_set_mutter_screen_cast_proxy (GrdContext *context, + GrdDBusMutterScreenCast *proxy); GrdSettings * grd_context_get_settings (GrdContext *context); diff --git a/src/grd-daemon.c b/src/grd-daemon.c index 7ff7df04..21555a9e 100644 --- a/src/grd-daemon.c +++ b/src/grd-daemon.c @@ -32,7 +32,7 @@ #include #include "grd-context.h" -#include "grd-dbus-remote-desktop.h" +#include "grd-dbus-mutter-remote-desktop.h" #include "grd-private.h" #include "grd-rdp-server.h" #include "grd-session.h" @@ -46,8 +46,8 @@ struct _GrdDaemon GSource *sigterm_source; GCancellable *cancellable; - guint remote_desktop_watch_name_id; - guint screen_cast_watch_name_id; + guint mutter_remote_desktop_watch_name_id; + guint mutter_screen_cast_watch_name_id; GrdContext *context; @@ -64,8 +64,8 @@ G_DEFINE_TYPE (GrdDaemon, grd_daemon, G_TYPE_APPLICATION) static gboolean is_daemon_ready (GrdDaemon *daemon) { - if (!grd_context_get_remote_desktop_proxy (daemon->context) || - !grd_context_get_screen_cast_proxy (daemon->context)) + if (!grd_context_get_mutter_remote_desktop_proxy (daemon->context) || + !grd_context_get_mutter_screen_cast_proxy (daemon->context)) return FALSE; return TRUE; @@ -179,15 +179,15 @@ disable_services (GrdDaemon *daemon) } static void -on_remote_desktop_proxy_acquired (GObject *object, - GAsyncResult *result, - gpointer user_data) +on_mutter_remote_desktop_proxy_acquired (GObject *object, + GAsyncResult *result, + gpointer user_data) { GrdDaemon *daemon = user_data; - GrdDBusRemoteDesktop *proxy; + GrdDBusMutterRemoteDesktop *proxy; GError *error = NULL; - proxy = grd_dbus_remote_desktop_proxy_new_for_bus_finish (result, &error); + proxy = grd_dbus_mutter_remote_desktop_proxy_new_for_bus_finish (result, &error); if (!proxy) { g_warning ("Failed to create remote desktop proxy: %s", error->message); @@ -195,86 +195,86 @@ on_remote_desktop_proxy_acquired (GObject *object, return; } - grd_context_set_remote_desktop_proxy (daemon->context, proxy); + grd_context_set_mutter_remote_desktop_proxy (daemon->context, proxy); maybe_enable_services (daemon); } static void -on_screen_cast_proxy_acquired (GObject *object, - GAsyncResult *result, - gpointer user_data) +on_mutter_screen_cast_proxy_acquired (GObject *object, + GAsyncResult *result, + gpointer user_data) { GrdDaemon *daemon = user_data; - GrdDBusScreenCast *proxy; + GrdDBusMutterScreenCast *proxy; GError *error = NULL; - proxy = grd_dbus_screen_cast_proxy_new_for_bus_finish (result, &error); + proxy = grd_dbus_mutter_screen_cast_proxy_new_for_bus_finish (result, &error); if (!proxy) { g_warning ("Failed to create screen cast proxy: %s", error->message); return; } - grd_context_set_screen_cast_proxy (daemon->context, proxy); + grd_context_set_mutter_screen_cast_proxy (daemon->context, proxy); maybe_enable_services (daemon); } static void -on_remote_desktop_name_appeared (GDBusConnection *connection, - const char *name, - const char *name_owner, - gpointer user_data) +on_mutter_remote_desktop_name_appeared (GDBusConnection *connection, + const char *name, + const char *name_owner, + gpointer user_data) { GrdDaemon *daemon = user_data; - grd_dbus_remote_desktop_proxy_new_for_bus (G_BUS_TYPE_SESSION, - G_DBUS_PROXY_FLAGS_NONE, - MUTTER_REMOTE_DESKTOP_BUS_NAME, - MUTTER_REMOTE_DESKTOP_OBJECT_PATH, - daemon->cancellable, - on_remote_desktop_proxy_acquired, - daemon); + grd_dbus_mutter_remote_desktop_proxy_new_for_bus (G_BUS_TYPE_SESSION, + G_DBUS_PROXY_FLAGS_NONE, + MUTTER_REMOTE_DESKTOP_BUS_NAME, + MUTTER_REMOTE_DESKTOP_OBJECT_PATH, + daemon->cancellable, + on_mutter_remote_desktop_proxy_acquired, + daemon); } static void -on_remote_desktop_name_vanished (GDBusConnection *connection, - const char *name, - gpointer user_data) +on_mutter_remote_desktop_name_vanished (GDBusConnection *connection, + const char *name, + gpointer user_data) { GrdDaemon *daemon = user_data; disable_services (daemon); - grd_context_set_remote_desktop_proxy (daemon->context, NULL); + grd_context_set_mutter_remote_desktop_proxy (daemon->context, NULL); } static void -on_screen_cast_name_appeared (GDBusConnection *connection, - const char *name, - const char *name_owner, - gpointer user_data) +on_mutter_screen_cast_name_appeared (GDBusConnection *connection, + const char *name, + const char *name_owner, + gpointer user_data) { GrdDaemon *daemon = user_data; - grd_dbus_screen_cast_proxy_new_for_bus (G_BUS_TYPE_SESSION, - G_DBUS_PROXY_FLAGS_NONE, - MUTTER_SCREEN_CAST_BUS_NAME, - MUTTER_SCREEN_CAST_OBJECT_PATH, - daemon->cancellable, - on_screen_cast_proxy_acquired, - daemon); + grd_dbus_mutter_screen_cast_proxy_new_for_bus (G_BUS_TYPE_SESSION, + G_DBUS_PROXY_FLAGS_NONE, + MUTTER_SCREEN_CAST_BUS_NAME, + MUTTER_SCREEN_CAST_OBJECT_PATH, + daemon->cancellable, + on_mutter_screen_cast_proxy_acquired, + daemon); } static void -on_screen_cast_name_vanished (GDBusConnection *connection, - const char *name, - gpointer user_data) +on_mutter_screen_cast_name_vanished (GDBusConnection *connection, + const char *name, + gpointer user_data) { GrdDaemon *daemon = user_data; disable_services (daemon); - grd_context_set_screen_cast_proxy (daemon->context, NULL); + grd_context_set_mutter_screen_cast_proxy (daemon->context, NULL); } #ifdef HAVE_RDP @@ -327,20 +327,20 @@ grd_daemon_startup (GApplication *app) { GrdDaemon *daemon = GRD_DAEMON (app); - daemon->remote_desktop_watch_name_id = + daemon->mutter_remote_desktop_watch_name_id = g_bus_watch_name (G_BUS_TYPE_SESSION, MUTTER_REMOTE_DESKTOP_BUS_NAME, G_BUS_NAME_WATCHER_FLAGS_NONE, - on_remote_desktop_name_appeared, - on_remote_desktop_name_vanished, + on_mutter_remote_desktop_name_appeared, + on_mutter_remote_desktop_name_vanished, daemon, NULL); - daemon->screen_cast_watch_name_id = + daemon->mutter_screen_cast_watch_name_id = g_bus_watch_name (G_BUS_TYPE_SESSION, MUTTER_SCREEN_CAST_BUS_NAME, G_BUS_NAME_WATCHER_FLAGS_NONE, - on_screen_cast_name_appeared, - on_screen_cast_name_vanished, + on_mutter_screen_cast_name_appeared, + on_mutter_screen_cast_name_vanished, daemon, NULL); daemon->cancellable = g_cancellable_new (); @@ -361,13 +361,13 @@ grd_daemon_shutdown (GApplication *app) disable_services (daemon); - grd_context_set_remote_desktop_proxy (daemon->context, NULL); - g_bus_unwatch_name (daemon->remote_desktop_watch_name_id); - daemon->remote_desktop_watch_name_id = 0; + grd_context_set_mutter_remote_desktop_proxy (daemon->context, NULL); + g_bus_unwatch_name (daemon->mutter_remote_desktop_watch_name_id); + daemon->mutter_remote_desktop_watch_name_id = 0; - grd_context_set_screen_cast_proxy (daemon->context, NULL); - g_bus_unwatch_name (daemon->screen_cast_watch_name_id); - daemon->screen_cast_watch_name_id = 0; + grd_context_set_mutter_screen_cast_proxy (daemon->context, NULL); + g_bus_unwatch_name (daemon->mutter_screen_cast_watch_name_id); + daemon->mutter_screen_cast_watch_name_id = 0; g_clear_object (&daemon->context); diff --git a/src/grd-daemon.h b/src/grd-daemon.h index 3f58eb6a..53324575 100644 --- a/src/grd-daemon.h +++ b/src/grd-daemon.h @@ -25,13 +25,13 @@ #include -#include "grd-dbus-remote-desktop.h" +#include "grd-dbus-mutter-remote-desktop.h" typedef struct _GrdDaemon GrdDaemon; #define GRD_TYPE_DAEMON (grd_daemon_get_type ()) G_DECLARE_FINAL_TYPE (GrdDaemon, grd_daemon, GRD, DAEMON, GApplication) -GrdDBusRemoteDesktop *grd_daemon_get_dbus_proxy (GrdDaemon *daemon); +GrdDBusMutterRemoteDesktop *grd_daemon_get_dbus_proxy (GrdDaemon *daemon); #endif /* GRD_DAEMON_H */ diff --git a/src/grd-session.c b/src/grd-session.c index bf74a1ca..cc771c97 100644 --- a/src/grd-session.c +++ b/src/grd-session.c @@ -31,7 +31,7 @@ #include #include "grd-clipboard.h" -#include "grd-dbus-remote-desktop.h" +#include "grd-dbus-mutter-remote-desktop.h" #include "grd-context.h" #include "grd-private.h" #include "grd-stream.h" @@ -71,8 +71,8 @@ typedef struct _GrdSessionPrivate { GrdContext *context; - GrdDBusRemoteDesktopSession *remote_desktop_session; - GrdDBusScreenCastSession *screen_cast_session; + GrdDBusMutterRemoteDesktopSession *remote_desktop_session; + GrdDBusMutterScreenCastSession *screen_cast_session; GHashTable *stream_table; @@ -110,10 +110,10 @@ grd_session_stop (GrdSession *session) if (priv->remote_desktop_session && priv->started) { - GrdDBusRemoteDesktopSession *proxy = priv->remote_desktop_session; + GrdDBusMutterRemoteDesktopSession *proxy = priv->remote_desktop_session; GError *error = NULL; - if (!grd_dbus_remote_desktop_session_call_stop_sync (proxy, NULL, &error)) + if (!grd_dbus_mutter_remote_desktop_session_call_stop_sync (proxy, NULL, &error)) { g_warning ("Failed to stop: %s\n", error->message); g_error_free (error); @@ -157,12 +157,12 @@ on_screen_cast_stream_start_finished (GObject *object, GAsyncResult *result, gpointer user_data) { - GrdDBusScreenCastStream *stream_proxy = GRD_DBUS_SCREEN_CAST_STREAM (object); + GrdDBusMutterScreenCastStream *stream_proxy = GRD_DBUS_MUTTER_SCREEN_CAST_STREAM (object); g_autoptr (GError) error = NULL; - if (!grd_dbus_screen_cast_stream_call_start_finish (stream_proxy, - result, - &error)) + if (!grd_dbus_mutter_screen_cast_stream_call_start_finish (stream_proxy, + result, + &error)) { if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) return; @@ -178,13 +178,13 @@ on_screen_cast_stream_proxy_acquired (GObject *object, GAsyncResult *result, gpointer user_data) { - GrdDBusScreenCastStream *stream_proxy; + GrdDBusMutterScreenCastStream *stream_proxy; GrdSession *session; GrdSessionPrivate *priv; g_autoptr (GError) error = NULL; GrdStream *stream; - stream_proxy = grd_dbus_screen_cast_stream_proxy_new_finish (result, &error); + stream_proxy = grd_dbus_mutter_screen_cast_stream_proxy_new_finish (result, &error); if (!stream_proxy) { if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) @@ -206,10 +206,10 @@ on_screen_cast_stream_proxy_acquired (GObject *object, g_hash_table_add (priv->stream_table, stream); - grd_dbus_screen_cast_stream_call_start (stream_proxy, - priv->cancellable, - on_screen_cast_stream_start_finished, - session); + grd_dbus_mutter_screen_cast_stream_call_start (stream_proxy, + priv->cancellable, + on_screen_cast_stream_start_finished, + session); } static const char * @@ -237,7 +237,7 @@ on_record_finished (GObject *object, GAsyncResult *result, gpointer user_data) { - GrdDBusScreenCastSession *proxy = GRD_DBUS_SCREEN_CAST_SESSION (object); + GrdDBusMutterScreenCastSession *proxy = GRD_DBUS_MUTTER_SCREEN_CAST_SESSION (object); g_autofree AsyncDBusRecordCallContext *async_context = user_data; ScreenCastType screen_cast_type = async_context->screen_cast_type; GrdSession *session; @@ -253,7 +253,7 @@ on_record_finished (GObject *object, g_assert_not_reached (); break; case SCREEN_CAST_TYPE_MONITOR: - retval = grd_dbus_screen_cast_session_call_record_monitor_finish ( + retval = grd_dbus_mutter_screen_cast_session_call_record_monitor_finish ( proxy, &stream_path, result, &error); break; case SCREEN_CAST_TYPE_WINDOW: @@ -261,7 +261,7 @@ on_record_finished (GObject *object, g_assert_not_reached (); break; case SCREEN_CAST_TYPE_VIRTUAL: - retval = grd_dbus_screen_cast_session_call_record_virtual_finish ( + retval = grd_dbus_mutter_screen_cast_session_call_record_virtual_finish ( proxy, &stream_path, result, &error); break; } @@ -281,13 +281,13 @@ on_record_finished (GObject *object, priv = grd_session_get_instance_private (session); connection = g_dbus_proxy_get_connection (G_DBUS_PROXY (proxy)); - grd_dbus_screen_cast_stream_proxy_new (connection, - G_DBUS_PROXY_FLAGS_NONE, - MUTTER_SCREEN_CAST_BUS_NAME, - stream_path, - priv->cancellable, - on_screen_cast_stream_proxy_acquired, - session); + grd_dbus_mutter_screen_cast_stream_proxy_new (connection, + G_DBUS_PROXY_FLAGS_NONE, + MUTTER_SCREEN_CAST_BUS_NAME, + stream_path, + priv->cancellable, + on_screen_cast_stream_proxy_acquired, + session); } void @@ -307,12 +307,12 @@ grd_session_record_monitor (GrdSession *session, g_variant_builder_add (&properties_builder, "{sv}", "cursor-mode", g_variant_new_uint32 (cursor_mode)); - grd_dbus_screen_cast_session_call_record_monitor (priv->screen_cast_session, - connector ? connector : "", - g_variant_builder_end (&properties_builder), - priv->cancellable, - on_record_finished, - async_context); + grd_dbus_mutter_screen_cast_session_call_record_monitor (priv->screen_cast_session, + connector ? connector : "", + g_variant_builder_end (&properties_builder), + priv->cancellable, + on_record_finished, + async_context); } void @@ -334,11 +334,11 @@ grd_session_record_virtual (GrdSession *session, g_variant_builder_add (&properties_builder, "{sv}", "is-platform", g_variant_new_boolean (is_platform)); - grd_dbus_screen_cast_session_call_record_virtual (priv->screen_cast_session, - g_variant_builder_end (&properties_builder), - priv->cancellable, - on_record_finished, - async_context); + grd_dbus_mutter_screen_cast_session_call_record_virtual (priv->screen_cast_session, + g_variant_builder_end (&properties_builder), + priv->cancellable, + on_record_finished, + async_context); } void @@ -347,14 +347,14 @@ grd_session_notify_keyboard_keycode (GrdSession *session, GrdKeyState state) { GrdSessionPrivate *priv = grd_session_get_instance_private (session); - GrdDBusRemoteDesktopSession *session_proxy = priv->remote_desktop_session; - - grd_dbus_remote_desktop_session_call_notify_keyboard_keycode (session_proxy, - keycode, - state, - NULL, - NULL, - NULL); + GrdDBusMutterRemoteDesktopSession *session_proxy = priv->remote_desktop_session; + + grd_dbus_mutter_remote_desktop_session_call_notify_keyboard_keycode (session_proxy, + keycode, + state, + NULL, + NULL, + NULL); } void @@ -363,14 +363,14 @@ grd_session_notify_keyboard_keysym (GrdSession *session, GrdKeyState state) { GrdSessionPrivate *priv = grd_session_get_instance_private (session); - GrdDBusRemoteDesktopSession *session_proxy = priv->remote_desktop_session; - - grd_dbus_remote_desktop_session_call_notify_keyboard_keysym (session_proxy, - keysym, - state, - NULL, - NULL, - NULL); + GrdDBusMutterRemoteDesktopSession *session_proxy = priv->remote_desktop_session; + + grd_dbus_mutter_remote_desktop_session_call_notify_keyboard_keysym (session_proxy, + keysym, + state, + NULL, + NULL, + NULL); } void @@ -379,14 +379,14 @@ grd_session_notify_pointer_button (GrdSession *session, GrdButtonState state) { GrdSessionPrivate *priv = grd_session_get_instance_private (session); - GrdDBusRemoteDesktopSession *session_proxy = priv->remote_desktop_session; - - grd_dbus_remote_desktop_session_call_notify_pointer_button (session_proxy, - button, - state, - NULL, - NULL, - NULL); + GrdDBusMutterRemoteDesktopSession *session_proxy = priv->remote_desktop_session; + + grd_dbus_mutter_remote_desktop_session_call_notify_pointer_button (session_proxy, + button, + state, + NULL, + NULL, + NULL); } void @@ -396,9 +396,9 @@ grd_session_notify_pointer_axis (GrdSession *session, GrdPointerAxisFlags flags) { GrdSessionPrivate *priv = grd_session_get_instance_private (session); - GrdDBusRemoteDesktopSession *session_proxy = priv->remote_desktop_session; + GrdDBusMutterRemoteDesktopSession *session_proxy = priv->remote_desktop_session; - grd_dbus_remote_desktop_session_call_notify_pointer_axis ( + grd_dbus_mutter_remote_desktop_session_call_notify_pointer_axis ( session_proxy, dx, dy, flags, NULL, NULL, NULL); } @@ -408,9 +408,9 @@ grd_session_notify_pointer_axis_discrete (GrdSession *session, int steps) { GrdSessionPrivate *priv = grd_session_get_instance_private (session); - GrdDBusRemoteDesktopSession *session_proxy = priv->remote_desktop_session; + GrdDBusMutterRemoteDesktopSession *session_proxy = priv->remote_desktop_session; - grd_dbus_remote_desktop_session_call_notify_pointer_axis_discrete ( + grd_dbus_mutter_remote_desktop_session_call_notify_pointer_axis_discrete ( session_proxy, axis, steps, NULL, NULL, NULL); } @@ -428,7 +428,7 @@ grd_session_notify_pointer_motion_absolute (GrdSession *session, stream_path = grd_stream_get_object_path (stream); - grd_dbus_remote_desktop_session_call_notify_pointer_motion_absolute ( + grd_dbus_mutter_remote_desktop_session_call_notify_pointer_motion_absolute ( priv->remote_desktop_session, stream_path, x, y, NULL, NULL, NULL); } @@ -481,7 +481,7 @@ grd_session_enable_clipboard (GrdSession *session, return FALSE; options_variant = serialize_clipboard_options (mime_type_tables); - if (!grd_dbus_remote_desktop_session_call_enable_clipboard_sync ( + if (!grd_dbus_mutter_remote_desktop_session_call_enable_clipboard_sync ( priv->remote_desktop_session, options_variant, NULL, &error)) { g_warning ("Failed to enable clipboard: %s", error->message); @@ -501,7 +501,7 @@ grd_session_disable_clipboard (GrdSession *session) if (!priv->remote_desktop_session) return; - grd_dbus_remote_desktop_session_call_disable_clipboard ( + grd_dbus_mutter_remote_desktop_session_call_disable_clipboard ( priv->remote_desktop_session, NULL, NULL, NULL); } @@ -515,7 +515,7 @@ grd_session_set_selection (GrdSession *session, options_variant = serialize_clipboard_options (mime_type_tables); - if (!grd_dbus_remote_desktop_session_call_set_selection_sync ( + if (!grd_dbus_mutter_remote_desktop_session_call_set_selection_sync ( priv->remote_desktop_session, options_variant, NULL, &error)) g_warning ("Failed to set selection: %s", error->message); } @@ -571,12 +571,12 @@ grd_session_selection_write (GrdSession *session, if (!data || !size) { - grd_dbus_remote_desktop_session_call_selection_write_done ( + grd_dbus_mutter_remote_desktop_session_call_selection_write_done ( priv->remote_desktop_session, serial, FALSE, NULL, NULL, NULL); return; } - if (!grd_dbus_remote_desktop_session_call_selection_write_sync ( + if (!grd_dbus_mutter_remote_desktop_session_call_selection_write_sync ( priv->remote_desktop_session, serial, NULL, &fd_variant, &fd_list, NULL, &error)) { @@ -596,14 +596,14 @@ grd_session_selection_write (GrdSession *session, if (write (fd, data, size) < 0) { - grd_dbus_remote_desktop_session_call_selection_write_done ( + grd_dbus_mutter_remote_desktop_session_call_selection_write_done ( priv->remote_desktop_session, serial, FALSE, NULL, NULL, NULL); close (fd); return; } - grd_dbus_remote_desktop_session_call_selection_write_done ( + grd_dbus_mutter_remote_desktop_session_call_selection_write_done ( priv->remote_desktop_session, serial, TRUE, NULL, NULL, NULL); close (fd); @@ -622,7 +622,7 @@ grd_session_selection_read (GrdSession *session, const char *mime_type_string; mime_type_string = grd_mime_type_to_string (mime_type); - if (!grd_dbus_remote_desktop_session_call_selection_read_sync ( + if (!grd_dbus_mutter_remote_desktop_session_call_selection_read_sync ( priv->remote_desktop_session, mime_type_string, NULL, &fd_variant, &fd_list, NULL, &error)) { @@ -646,16 +646,16 @@ on_session_start_finished (GObject *object, GAsyncResult *result, gpointer user_data) { - GrdDBusRemoteDesktopSession *proxy; + GrdDBusMutterRemoteDesktopSession *proxy; GrdSession *session; GrdSessionPrivate *priv; GrdSessionClass *klass; g_autoptr (GError) error = NULL; - proxy = GRD_DBUS_REMOTE_DESKTOP_SESSION (object); - if (!grd_dbus_remote_desktop_session_call_start_finish (proxy, - result, - &error)) + proxy = GRD_DBUS_MUTTER_REMOTE_DESKTOP_SESSION (object); + if (!grd_dbus_mutter_remote_desktop_session_call_start_finish (proxy, + result, + &error)) { if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) return; @@ -679,12 +679,12 @@ static void start_session (GrdSession *session) { GrdSessionPrivate *priv = grd_session_get_instance_private (session); - GrdDBusRemoteDesktopSession *proxy = priv->remote_desktop_session; + GrdDBusMutterRemoteDesktopSession *proxy = priv->remote_desktop_session; - grd_dbus_remote_desktop_session_call_start (proxy, - priv->cancellable, - on_session_start_finished, - session); + grd_dbus_mutter_remote_desktop_session_call_start (proxy, + priv->cancellable, + on_session_start_finished, + session); } static void @@ -692,13 +692,13 @@ on_screen_cast_session_proxy_acquired (GObject *object, GAsyncResult *result, gpointer user_data) { - GrdDBusScreenCastSession *session_proxy; + GrdDBusMutterScreenCastSession *session_proxy; GrdSession *session; GrdSessionPrivate *priv; g_autoptr (GError) error = NULL; session_proxy = - grd_dbus_screen_cast_session_proxy_new_finish (result, &error); + grd_dbus_mutter_screen_cast_session_proxy_new_finish (result, &error); if (!session_proxy) { if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) @@ -723,18 +723,18 @@ on_screen_cast_session_created (GObject *source_object, GAsyncResult *res, gpointer user_data) { - GrdDBusScreenCast *screen_cast_proxy; + GrdDBusMutterScreenCast *screen_cast_proxy; GrdSession *session; GrdSessionPrivate *priv; GDBusConnection *connection; g_autofree char *session_path = NULL; g_autoptr (GError) error = NULL; - screen_cast_proxy = GRD_DBUS_SCREEN_CAST (source_object); - if (!grd_dbus_screen_cast_call_create_session_finish (screen_cast_proxy, - &session_path, - res, - &error)) + screen_cast_proxy = GRD_DBUS_MUTTER_SCREEN_CAST (source_object); + if (!grd_dbus_mutter_screen_cast_call_create_session_finish (screen_cast_proxy, + &session_path, + res, + &error)) { if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) return; @@ -748,18 +748,18 @@ on_screen_cast_session_created (GObject *source_object, priv = grd_session_get_instance_private (session); connection = g_dbus_proxy_get_connection (G_DBUS_PROXY (screen_cast_proxy)); - grd_dbus_screen_cast_session_proxy_new (connection, - G_DBUS_PROXY_FLAGS_NONE, - MUTTER_SCREEN_CAST_BUS_NAME, - session_path, - priv->cancellable, - on_screen_cast_session_proxy_acquired, - session); + grd_dbus_mutter_screen_cast_session_proxy_new (connection, + G_DBUS_PROXY_FLAGS_NONE, + MUTTER_SCREEN_CAST_BUS_NAME, + session_path, + priv->cancellable, + on_screen_cast_session_proxy_acquired, + session); } static void -on_remote_desktop_session_closed (GrdDBusRemoteDesktopSession *session_proxy, - GrdSession *session) +on_remote_desktop_session_closed (GrdDBusMutterRemoteDesktopSession *session_proxy, + GrdSession *session) { GrdSessionPrivate *priv = grd_session_get_instance_private (session); @@ -775,9 +775,9 @@ on_remote_desktop_session_closed (GrdDBusRemoteDesktopSession *session_proxy, } static void -on_remote_desktop_session_selection_owner_changed (GrdDBusRemoteDesktopSession *session_proxy, - GVariant *options_variant, - GrdSession *session) +on_remote_desktop_session_selection_owner_changed (GrdDBusMutterRemoteDesktopSession *session_proxy, + GVariant *options_variant, + GrdSession *session) { GrdSessionPrivate *priv = grd_session_get_instance_private (session); GVariant *is_owner_variant, *mime_types_variant; @@ -822,10 +822,10 @@ on_remote_desktop_session_selection_owner_changed (GrdDBusRemoteDesktopSession * } static void -on_remote_desktop_session_selection_transfer (GrdDBusRemoteDesktopSession *session_proxy, - char *mime_type_string, - unsigned int serial, - GrdSession *session) +on_remote_desktop_session_selection_transfer (GrdDBusMutterRemoteDesktopSession *session_proxy, + char *mime_type_string, + unsigned int serial, + GrdSession *session) { GrdSessionPrivate *priv = grd_session_get_instance_private (session); GrdMimeType mime_type; @@ -836,7 +836,7 @@ on_remote_desktop_session_selection_transfer (GrdDBusRemoteDesktopSession *sessi mime_type = grd_mime_type_from_string (mime_type_string); if (mime_type == GRD_MIME_TYPE_NONE) { - grd_dbus_remote_desktop_session_call_selection_write_done ( + grd_dbus_mutter_remote_desktop_session_call_selection_write_done ( priv->remote_desktop_session, serial, FALSE, NULL, NULL, NULL); return; } @@ -846,14 +846,14 @@ on_remote_desktop_session_selection_transfer (GrdDBusRemoteDesktopSession *sessi } static void -on_caps_lock_state_changed (GrdDBusRemoteDesktopSession *session_proxy, - GParamSpec *param_spec, - GrdSession *session) +on_caps_lock_state_changed (GrdDBusMutterRemoteDesktopSession *session_proxy, + GParamSpec *param_spec, + GrdSession *session) { GrdSessionClass *klass = GRD_SESSION_GET_CLASS (session); gboolean state; - state = grd_dbus_remote_desktop_session_get_caps_lock_state (session_proxy); + state = grd_dbus_mutter_remote_desktop_session_get_caps_lock_state (session_proxy); g_debug ("Caps lock state: %s", state ? "locked" : "unlocked"); if (klass->on_caps_lock_state_changed) @@ -861,14 +861,14 @@ on_caps_lock_state_changed (GrdDBusRemoteDesktopSession *session_proxy, } static void -on_num_lock_state_changed (GrdDBusRemoteDesktopSession *session_proxy, - GParamSpec *param_spec, - GrdSession *session) +on_num_lock_state_changed (GrdDBusMutterRemoteDesktopSession *session_proxy, + GParamSpec *param_spec, + GrdSession *session) { GrdSessionClass *klass = GRD_SESSION_GET_CLASS (session); gboolean state; - state = grd_dbus_remote_desktop_session_get_num_lock_state (session_proxy); + state = grd_dbus_mutter_remote_desktop_session_get_num_lock_state (session_proxy); g_debug ("Num lock state: %s", state ? "locked" : "unlocked"); if (klass->on_num_lock_state_changed) @@ -880,18 +880,18 @@ on_remote_desktop_session_proxy_acquired (GObject *object, GAsyncResult *result, gpointer user_data) { - GrdDBusRemoteDesktopSession *session_proxy; + GrdDBusMutterRemoteDesktopSession *session_proxy; GrdSession *session; GrdSessionPrivate *priv; GrdSessionClass *klass; g_autoptr (GError) error = NULL; const char *remote_desktop_session_id; - GrdDBusScreenCast *screen_cast_proxy; + GrdDBusMutterScreenCast *screen_cast_proxy; GVariantBuilder properties_builder; GVariant *properties_variant; session_proxy = - grd_dbus_remote_desktop_session_proxy_new_finish (result, &error); + grd_dbus_mutter_remote_desktop_session_proxy_new_finish (result, &error); if (!session_proxy) { if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) @@ -920,7 +920,7 @@ on_remote_desktop_session_proxy_acquired (GObject *object, priv->remote_desktop_session = session_proxy; remote_desktop_session_id = - grd_dbus_remote_desktop_session_get_session_id (session_proxy); + grd_dbus_mutter_remote_desktop_session_get_session_id (session_proxy); g_variant_builder_init (&properties_builder, G_VARIANT_TYPE ("a{sv}")); g_variant_builder_add (&properties_builder, "{sv}", @@ -931,12 +931,12 @@ on_remote_desktop_session_proxy_acquired (GObject *object, g_variant_new_boolean (TRUE)); properties_variant = g_variant_builder_end (&properties_builder); - screen_cast_proxy = grd_context_get_screen_cast_proxy (priv->context); - grd_dbus_screen_cast_call_create_session (screen_cast_proxy, - properties_variant, - priv->cancellable, - on_screen_cast_session_created, - session); + screen_cast_proxy = grd_context_get_mutter_screen_cast_proxy (priv->context); + grd_dbus_mutter_screen_cast_call_create_session (screen_cast_proxy, + properties_variant, + priv->cancellable, + on_screen_cast_session_created, + session); priv->caps_lock_state_changed_id = g_signal_connect (session_proxy, "notify::caps-lock-state", @@ -959,18 +959,18 @@ on_remote_desktop_session_created (GObject *source_object, GAsyncResult *res, gpointer user_data) { - GrdDBusRemoteDesktop *remote_desktop_proxy; + GrdDBusMutterRemoteDesktop *remote_desktop_proxy; GrdSession *session; GrdSessionPrivate *priv; GDBusConnection *connection; g_autofree char *session_path = NULL; g_autoptr (GError) error = NULL; - remote_desktop_proxy = GRD_DBUS_REMOTE_DESKTOP (source_object); - if (!grd_dbus_remote_desktop_call_create_session_finish (remote_desktop_proxy, - &session_path, - res, - &error)) + remote_desktop_proxy = GRD_DBUS_MUTTER_REMOTE_DESKTOP (source_object); + if (!grd_dbus_mutter_remote_desktop_call_create_session_finish (remote_desktop_proxy, + &session_path, + res, + &error)) { if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) return; @@ -984,28 +984,28 @@ on_remote_desktop_session_created (GObject *source_object, priv = grd_session_get_instance_private (session); connection = g_dbus_proxy_get_connection (G_DBUS_PROXY (remote_desktop_proxy)); - grd_dbus_remote_desktop_session_proxy_new (connection, - G_DBUS_PROXY_FLAGS_NONE, - MUTTER_REMOTE_DESKTOP_BUS_NAME, - session_path, - priv->cancellable, - on_remote_desktop_session_proxy_acquired, - session); + grd_dbus_mutter_remote_desktop_session_proxy_new (connection, + G_DBUS_PROXY_FLAGS_NONE, + MUTTER_REMOTE_DESKTOP_BUS_NAME, + session_path, + priv->cancellable, + on_remote_desktop_session_proxy_acquired, + session); } void grd_session_start (GrdSession *session) { GrdSessionPrivate *priv = grd_session_get_instance_private (session); - GrdDBusRemoteDesktop *remote_desktop_proxy; + GrdDBusMutterRemoteDesktop *remote_desktop_proxy; priv->cancellable = g_cancellable_new (); - remote_desktop_proxy = grd_context_get_remote_desktop_proxy (priv->context); - grd_dbus_remote_desktop_call_create_session (remote_desktop_proxy, - priv->cancellable, - on_remote_desktop_session_created, - session); + remote_desktop_proxy = grd_context_get_mutter_remote_desktop_proxy (priv->context); + grd_dbus_mutter_remote_desktop_call_create_session (remote_desktop_proxy, + priv->cancellable, + on_remote_desktop_session_created, + session); } static void diff --git a/src/grd-stream.c b/src/grd-stream.c index f75ca22e..9fbdcc6d 100644 --- a/src/grd-stream.c +++ b/src/grd-stream.c @@ -40,7 +40,7 @@ typedef struct _GrdStreamPrivate uint32_t pipewire_node_id; - GrdDBusScreenCastStream *proxy; + GrdDBusMutterScreenCastStream *proxy; unsigned long pipewire_stream_added_id; } GrdStreamPrivate; @@ -72,9 +72,9 @@ grd_stream_disconnect_proxy_signals (GrdStream *stream) } static void -on_pipewire_stream_added (GrdDBusScreenCastStream *proxy, - unsigned int node_id, - GrdStream *stream) +on_pipewire_stream_added (GrdDBusMutterScreenCastStream *proxy, + unsigned int node_id, + GrdStream *stream) { GrdStreamPrivate *priv = grd_stream_get_instance_private (stream); @@ -84,8 +84,8 @@ on_pipewire_stream_added (GrdDBusScreenCastStream *proxy, } GrdStream * -grd_stream_new (GrdContext *context, - GrdDBusScreenCastStream *proxy) +grd_stream_new (GrdContext *context, + GrdDBusMutterScreenCastStream *proxy) { GrdStream *stream; GrdStreamPrivate *priv; diff --git a/src/grd-stream.h b/src/grd-stream.h index d79668c8..7f39fec0 100644 --- a/src/grd-stream.h +++ b/src/grd-stream.h @@ -24,7 +24,7 @@ #include #include -#include "grd-dbus-screen-cast.h" +#include "grd-dbus-mutter-screen-cast.h" #include "grd-types.h" #define GRD_TYPE_STREAM (grd_stream_get_type ()) @@ -41,7 +41,7 @@ const char * grd_stream_get_object_path (GrdStream *stream); void grd_stream_disconnect_proxy_signals (GrdStream *stream); -GrdStream * grd_stream_new (GrdContext *context, - GrdDBusScreenCastStream *proxy); +GrdStream * grd_stream_new (GrdContext *context, + GrdDBusMutterScreenCastStream *proxy); #endif /* GRD_STREAM_H */ diff --git a/src/meson.build b/src/meson.build index ba65ea1f..10bec4d8 100644 --- a/src/meson.build +++ b/src/meson.build @@ -164,14 +164,14 @@ daemon_sources += credentials_sources gen_daemon_sources = [] -gen_daemon_sources += gnome.gdbus_codegen('grd-dbus-screen-cast', +gen_daemon_sources += gnome.gdbus_codegen('grd-dbus-mutter-screen-cast', 'org.gnome.Mutter.ScreenCast.xml', interface_prefix: 'org.gnome.Mutter.', - namespace: 'GrdDBus') -gen_daemon_sources += gnome.gdbus_codegen('grd-dbus-remote-desktop', + namespace: 'GrdDBusMutter') +gen_daemon_sources += gnome.gdbus_codegen('grd-dbus-mutter-remote-desktop', 'org.gnome.Mutter.RemoteDesktop.xml', interface_prefix: 'org.gnome.Mutter.', - namespace: 'GrdDBus') + namespace: 'GrdDBusMutter') daemon_sources += gen_daemon_sources -- GitLab From 4a774d9b18570409a945d3c9516b446167cda067 Mon Sep 17 00:00:00 2001 From: Joan Torres Date: Fri, 12 Aug 2022 11:07:47 +0200 Subject: [PATCH 2/2] daemon: Make daemon an abstract class Add an abstraction layer to allow different behaviours of the daemon depending on the runtime mode. At this moment, only the standard daemon-user is implemented. --- src/gnome-remote-desktop.service.in | 2 +- src/grd-control.c | 2 +- src/grd-daemon-user.c | 99 ++++++++ src/grd-daemon-user.h | 36 +++ src/grd-daemon.c | 377 ++++++++++++++++++---------- src/grd-daemon.h | 18 +- src/grd-private.h | 2 +- src/meson.build | 2 + 8 files changed, 397 insertions(+), 141 deletions(-) create mode 100644 src/grd-daemon-user.c create mode 100644 src/grd-daemon-user.h diff --git a/src/gnome-remote-desktop.service.in b/src/gnome-remote-desktop.service.in index 6c0dcfc0..e2aadca5 100644 --- a/src/gnome-remote-desktop.service.in +++ b/src/gnome-remote-desktop.service.in @@ -3,7 +3,7 @@ Description=GNOME Remote Desktop [Service] Type=dbus -BusName=org.gnome.RemoteDesktop +BusName=org.gnome.RemoteDesktop.User ExecStart=@libexecdir@/gnome-remote-desktop-daemon Restart=on-failure diff --git a/src/grd-control.c b/src/grd-control.c index dadcecd5..858ab10a 100644 --- a/src/grd-control.c +++ b/src/grd-control.c @@ -56,7 +56,7 @@ main (int argc, char **argv) return 1; } - app = g_application_new (GRD_DAEMON_APPLICATION_ID, 0); + app = g_application_new (GRD_DAEMON_USER_APPLICATION_ID, 0); if (!g_application_register (app, NULL, NULL)) { g_warning ("Failed to register with application\n"); diff --git a/src/grd-daemon-user.c b/src/grd-daemon-user.c new file mode 100644 index 00000000..79763792 --- /dev/null +++ b/src/grd-daemon-user.c @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2022 Red Hat Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + * Written by: + * Jonas Ådahl + */ + +#include "config.h" + +#include "grd-daemon-user.h" + +#include "grd-daemon.h" +#include "grd-private.h" +#include "grd-types.h" + +struct _GrdDaemonUser +{ + GrdDaemon parent; +}; + +G_DEFINE_TYPE (GrdDaemonUser, grd_daemon_user, GRD_TYPE_DAEMON) + +GrdDaemonUser * +grd_daemon_user_new (GrdRuntimeMode runtime_mode, + GError **error) +{ + GrdContext *context; + GrdDaemonUser *daemon; + + context = grd_context_new (runtime_mode, error); + if (!context) + return NULL; + + daemon = g_object_new (GRD_TYPE_DAEMON_USER, + "application-id", GRD_DAEMON_USER_APPLICATION_ID, + "flags", G_APPLICATION_IS_SERVICE, + "context", context, + NULL); + + return daemon; +} + +static void +grd_daemon_user_init (GrdDaemonUser *daemon) +{ +} + +static void +grd_daemon_user_startup (GApplication *app) +{ + GrdDaemon *daemon = GRD_DAEMON (app); + g_autoptr (GDBusConnection) connection = NULL; + + connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL); + grd_daemon_acquire_mutter_dbus_proxies (daemon, connection); + + g_signal_connect (daemon, "mutter-proxy-acquired", + G_CALLBACK (grd_daemon_maybe_enable_services), NULL); + + G_APPLICATION_CLASS (grd_daemon_user_parent_class)->startup (app); +} + +static gboolean +grd_daemon_user_is_ready (GrdDaemon *daemon) +{ + GrdContext *context = grd_daemon_get_context (daemon); + + if (!grd_context_get_mutter_remote_desktop_proxy (context) || + !grd_context_get_mutter_screen_cast_proxy (context)) + return FALSE; + + return TRUE; +} + +static void +grd_daemon_user_class_init (GrdDaemonUserClass *klass) +{ + GApplicationClass *g_application_class = G_APPLICATION_CLASS (klass); + GrdDaemonClass *daemon_class = GRD_DAEMON_CLASS (klass); + + g_application_class->startup = grd_daemon_user_startup; + + daemon_class->is_daemon_ready = grd_daemon_user_is_ready; +} diff --git a/src/grd-daemon-user.h b/src/grd-daemon-user.h new file mode 100644 index 00000000..cacc5005 --- /dev/null +++ b/src/grd-daemon-user.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2022 Red Hat Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + * Written by: + * Jonas Ådahl + */ + +#ifndef GRD_DAEMON_USER_H +#define GRD_DAEMON_USER_H + +#include "grd-daemon.h" + +#define GRD_TYPE_DAEMON_USER (grd_daemon_user_get_type ()) +G_DECLARE_FINAL_TYPE (GrdDaemonUser, + grd_daemon_user, + GRD, DAEMON_USER, + GrdDaemon) + +GrdDaemonUser *grd_daemon_user_new (GrdRuntimeMode runtime_mode, + GError **error); +#endif /* GRD_DAEMON_USER_H */ diff --git a/src/grd-daemon.c b/src/grd-daemon.c index 21555a9e..97f58e4b 100644 --- a/src/grd-daemon.c +++ b/src/grd-daemon.c @@ -32,16 +32,33 @@ #include #include "grd-context.h" +#include "grd-daemon-user.h" #include "grd-dbus-mutter-remote-desktop.h" #include "grd-private.h" #include "grd-rdp-server.h" #include "grd-session.h" #include "grd-vnc-server.h" -struct _GrdDaemon +enum { - GApplication parent; + PROP_0, + PROP_CONTEXT, +}; + +enum +{ + MUTTER_PROXY_ACQUIRED, + RDP_SERVER_STARTED, + RDP_SERVER_STOPPED, + + N_SIGNALS, +}; + +static guint signals[N_SIGNALS]; + +typedef struct _GrdDaemonPrivate +{ GSource *sigint_source; GSource *sigterm_source; @@ -57,52 +74,55 @@ struct _GrdDaemon #ifdef HAVE_VNC GrdVncServer *vnc_server; #endif -}; +} GrdDaemonPrivate; -G_DEFINE_TYPE (GrdDaemon, grd_daemon, G_TYPE_APPLICATION) +G_DEFINE_TYPE_WITH_PRIVATE (GrdDaemon, grd_daemon, G_TYPE_APPLICATION) -static gboolean -is_daemon_ready (GrdDaemon *daemon) +GrdContext * +grd_daemon_get_context (GrdDaemon *daemon) { - if (!grd_context_get_mutter_remote_desktop_proxy (daemon->context) || - !grd_context_get_mutter_screen_cast_proxy (daemon->context)) - return FALSE; + GrdDaemonPrivate *priv = grd_daemon_get_instance_private (daemon); - return TRUE; + return priv->context; } #ifdef HAVE_RDP static void stop_rdp_server (GrdDaemon *daemon) { - if (!daemon->rdp_server) + GrdDaemonPrivate *priv = grd_daemon_get_instance_private (daemon); + + if (!priv->rdp_server) return; - grd_rdp_server_stop (daemon->rdp_server); - g_clear_object (&daemon->rdp_server); + g_signal_emit (daemon, signals[RDP_SERVER_STOPPED], 0); + grd_rdp_server_stop (priv->rdp_server); + g_clear_object (&priv->rdp_server); g_message ("RDP server stopped"); } static void start_rdp_server (GrdDaemon *daemon) { - GrdSettings *settings = grd_context_get_settings (daemon->context); + GrdDaemonPrivate *priv = grd_daemon_get_instance_private (daemon); + GrdSettings *settings = grd_context_get_settings (priv->context); g_autoptr (GError) error = NULL; - if (daemon->rdp_server) + if (priv->rdp_server) return; if (!g_access (grd_settings_get_rdp_server_cert (settings), F_OK) && !g_access (grd_settings_get_rdp_server_key (settings), F_OK)) { - daemon->rdp_server = grd_rdp_server_new (daemon->context); - if (!grd_rdp_server_start (daemon->rdp_server, &error)) + priv->rdp_server = grd_rdp_server_new (priv->context); + if (!grd_rdp_server_start (priv->rdp_server, &error)) { g_warning ("Failed to start RDP server: %s\n", error->message); stop_rdp_server (daemon); } else { + g_signal_emit (daemon, signals[RDP_SERVER_STARTED], 0); g_message ("RDP server started"); } } @@ -117,24 +137,27 @@ start_rdp_server (GrdDaemon *daemon) static void stop_vnc_server (GrdDaemon *daemon) { - if (!daemon->vnc_server) + GrdDaemonPrivate *priv = grd_daemon_get_instance_private (daemon); + + if (!priv->vnc_server) return; - grd_vnc_server_stop (daemon->vnc_server); - g_clear_object (&daemon->vnc_server); + grd_vnc_server_stop (priv->vnc_server); + g_clear_object (&priv->vnc_server); g_message ("VNC server stopped"); } static void start_vnc_server (GrdDaemon *daemon) { + GrdDaemonPrivate *priv = grd_daemon_get_instance_private (daemon); g_autoptr (GError) error = NULL; - if (daemon->vnc_server) + if (priv->vnc_server) return; - daemon->vnc_server = grd_vnc_server_new (daemon->context); - if (!grd_vnc_server_start (daemon->vnc_server, &error)) + priv->vnc_server = grd_vnc_server_new (priv->context); + if (!grd_vnc_server_start (priv->vnc_server, &error)) { g_warning ("Failed to initialize VNC server: %s\n", error->message); stop_vnc_server (daemon); @@ -146,15 +169,16 @@ start_vnc_server (GrdDaemon *daemon) } #endif /* HAVE_VNC */ -static void -maybe_enable_services (GrdDaemon *daemon) +void +grd_daemon_maybe_enable_services (GrdDaemon *daemon) { - GrdSettings *settings = grd_context_get_settings (daemon->context); + GrdDaemonPrivate *priv = grd_daemon_get_instance_private (daemon); + GrdSettings *settings = grd_context_get_settings (priv->context); - if (!is_daemon_ready (daemon)) + if (!GRD_DAEMON_GET_CLASS (daemon)->is_daemon_ready (daemon)) return; - grd_context_notify_daemon_ready (daemon->context); + grd_context_notify_daemon_ready (priv->context); #ifdef HAVE_RDP if (grd_settings_is_rdp_enabled (settings)) @@ -184,6 +208,7 @@ on_mutter_remote_desktop_proxy_acquired (GObject *object, gpointer user_data) { GrdDaemon *daemon = user_data; + GrdDaemonPrivate *priv = grd_daemon_get_instance_private (daemon); GrdDBusMutterRemoteDesktop *proxy; GError *error = NULL; @@ -195,9 +220,9 @@ on_mutter_remote_desktop_proxy_acquired (GObject *object, return; } - grd_context_set_mutter_remote_desktop_proxy (daemon->context, proxy); + grd_context_set_mutter_remote_desktop_proxy (priv->context, proxy); - maybe_enable_services (daemon); + g_signal_emit (daemon, signals[MUTTER_PROXY_ACQUIRED], 0); } static void @@ -206,6 +231,7 @@ on_mutter_screen_cast_proxy_acquired (GObject *object, gpointer user_data) { GrdDaemon *daemon = user_data; + GrdDaemonPrivate *priv = grd_daemon_get_instance_private (daemon); GrdDBusMutterScreenCast *proxy; GError *error = NULL; @@ -216,9 +242,9 @@ on_mutter_screen_cast_proxy_acquired (GObject *object, return; } - grd_context_set_mutter_screen_cast_proxy (daemon->context, proxy); + grd_context_set_mutter_screen_cast_proxy (priv->context, proxy); - maybe_enable_services (daemon); + g_signal_emit (daemon, signals[MUTTER_PROXY_ACQUIRED], 0); } static void @@ -228,14 +254,15 @@ on_mutter_remote_desktop_name_appeared (GDBusConnection *connection, gpointer user_data) { GrdDaemon *daemon = user_data; - - grd_dbus_mutter_remote_desktop_proxy_new_for_bus (G_BUS_TYPE_SESSION, - G_DBUS_PROXY_FLAGS_NONE, - MUTTER_REMOTE_DESKTOP_BUS_NAME, - MUTTER_REMOTE_DESKTOP_OBJECT_PATH, - daemon->cancellable, - on_mutter_remote_desktop_proxy_acquired, - daemon); + GrdDaemonPrivate *priv = grd_daemon_get_instance_private (daemon); + + grd_dbus_mutter_remote_desktop_proxy_new (connection, + G_DBUS_PROXY_FLAGS_NONE, + MUTTER_REMOTE_DESKTOP_BUS_NAME, + MUTTER_REMOTE_DESKTOP_OBJECT_PATH, + priv->cancellable, + on_mutter_remote_desktop_proxy_acquired, + daemon); } static void @@ -244,9 +271,11 @@ on_mutter_remote_desktop_name_vanished (GDBusConnection *connection, gpointer user_data) { GrdDaemon *daemon = user_data; + GrdDaemonPrivate *priv = grd_daemon_get_instance_private (daemon); disable_services (daemon); - grd_context_set_mutter_remote_desktop_proxy (daemon->context, NULL); + + grd_context_set_mutter_remote_desktop_proxy (priv->context, NULL); } static void @@ -256,14 +285,15 @@ on_mutter_screen_cast_name_appeared (GDBusConnection *connection, gpointer user_data) { GrdDaemon *daemon = user_data; - - grd_dbus_mutter_screen_cast_proxy_new_for_bus (G_BUS_TYPE_SESSION, - G_DBUS_PROXY_FLAGS_NONE, - MUTTER_SCREEN_CAST_BUS_NAME, - MUTTER_SCREEN_CAST_OBJECT_PATH, - daemon->cancellable, - on_mutter_screen_cast_proxy_acquired, - daemon); + GrdDaemonPrivate *priv = grd_daemon_get_instance_private (daemon); + + grd_dbus_mutter_screen_cast_proxy_new (connection, + G_DBUS_PROXY_FLAGS_NONE, + MUTTER_SCREEN_CAST_BUS_NAME, + MUTTER_SCREEN_CAST_OBJECT_PATH, + priv->cancellable, + on_mutter_screen_cast_proxy_acquired, + daemon); } static void @@ -272,9 +302,36 @@ on_mutter_screen_cast_name_vanished (GDBusConnection *connection, gpointer user_data) { GrdDaemon *daemon = user_data; + GrdDaemonPrivate *priv = grd_daemon_get_instance_private (daemon); disable_services (daemon); - grd_context_set_mutter_screen_cast_proxy (daemon->context, NULL); + + grd_context_set_mutter_screen_cast_proxy (priv->context, NULL); +} + +void +grd_daemon_acquire_mutter_dbus_proxies (GrdDaemon *daemon, + GDBusConnection *connection) +{ + GrdDaemonPrivate *priv = grd_daemon_get_instance_private (daemon); + + g_clear_handle_id (&priv->mutter_remote_desktop_watch_name_id, g_bus_unwatch_name); + priv->mutter_remote_desktop_watch_name_id = + g_bus_watch_name_on_connection (connection, + MUTTER_REMOTE_DESKTOP_BUS_NAME, + G_BUS_NAME_WATCHER_FLAGS_NONE, + on_mutter_remote_desktop_name_appeared, + on_mutter_remote_desktop_name_vanished, + daemon, NULL); + + g_clear_handle_id (&priv->mutter_screen_cast_watch_name_id, g_bus_unwatch_name); + priv->mutter_screen_cast_watch_name_id = + g_bus_watch_name_on_connection (connection, + MUTTER_SCREEN_CAST_BUS_NAME, + G_BUS_NAME_WATCHER_FLAGS_NONE, + on_mutter_screen_cast_name_appeared, + on_mutter_screen_cast_name_vanished, + daemon, NULL); } #ifdef HAVE_RDP @@ -282,12 +339,14 @@ static void on_rdp_enabled_changed (GrdSettings *settings, GrdDaemon *daemon) { - if (!is_daemon_ready (daemon)) + GrdDaemonPrivate *priv = grd_daemon_get_instance_private (daemon); + + if (!GRD_DAEMON_GET_CLASS (daemon)->is_daemon_ready (daemon)) return; if (grd_settings_is_rdp_enabled (settings)) { - g_return_if_fail (!daemon->rdp_server); + g_return_if_fail (!priv->rdp_server); start_rdp_server (daemon); } else @@ -302,12 +361,14 @@ static void on_vnc_enabled_changed (GrdSettings *settings, GrdDaemon *daemon) { - if (!is_daemon_ready (daemon)) + GrdDaemonPrivate *priv = grd_daemon_get_instance_private (daemon); + + if (!GRD_DAEMON_GET_CLASS (daemon)->is_daemon_ready (daemon)) return; if (grd_settings_is_vnc_enabled (settings)) { - g_return_if_fail (!daemon->vnc_server); + g_return_if_fail (!priv->vnc_server); start_vnc_server (daemon); } else @@ -320,30 +381,28 @@ on_vnc_enabled_changed (GrdSettings *settings, static void grd_daemon_init (GrdDaemon *daemon) { + GrdDaemonPrivate *priv = grd_daemon_get_instance_private (daemon); + + priv->cancellable = g_cancellable_new (); } static void grd_daemon_startup (GApplication *app) { GrdDaemon *daemon = GRD_DAEMON (app); + GrdDaemonPrivate *priv = grd_daemon_get_instance_private (daemon); + GrdSettings *settings = grd_context_get_settings (priv->context); - daemon->mutter_remote_desktop_watch_name_id = - g_bus_watch_name (G_BUS_TYPE_SESSION, - MUTTER_REMOTE_DESKTOP_BUS_NAME, - G_BUS_NAME_WATCHER_FLAGS_NONE, - on_mutter_remote_desktop_name_appeared, - on_mutter_remote_desktop_name_vanished, - daemon, NULL); - - daemon->mutter_screen_cast_watch_name_id = - g_bus_watch_name (G_BUS_TYPE_SESSION, - MUTTER_SCREEN_CAST_BUS_NAME, - G_BUS_NAME_WATCHER_FLAGS_NONE, - on_mutter_screen_cast_name_appeared, - on_mutter_screen_cast_name_vanished, - daemon, NULL); - - daemon->cancellable = g_cancellable_new (); +#ifdef HAVE_RDP + g_signal_connect (settings, "rdp-enabled-changed", + G_CALLBACK (on_rdp_enabled_changed), + daemon); +#endif +#ifdef HAVE_VNC + g_signal_connect (settings, "vnc-enabled-changed", + G_CALLBACK (on_vnc_enabled_changed), + daemon); +#endif /* Run indefinitely, until told to exit. */ g_application_hold (app); @@ -355,43 +414,113 @@ static void grd_daemon_shutdown (GApplication *app) { GrdDaemon *daemon = GRD_DAEMON (app); + GrdDaemonPrivate *priv = grd_daemon_get_instance_private (daemon); - g_cancellable_cancel (daemon->cancellable); - g_clear_object (&daemon->cancellable); + g_cancellable_cancel (priv->cancellable); + g_clear_object (&priv->cancellable); disable_services (daemon); - grd_context_set_mutter_remote_desktop_proxy (daemon->context, NULL); - g_bus_unwatch_name (daemon->mutter_remote_desktop_watch_name_id); - daemon->mutter_remote_desktop_watch_name_id = 0; + grd_context_set_mutter_remote_desktop_proxy (priv->context, NULL); + g_clear_handle_id (&priv->mutter_remote_desktop_watch_name_id, g_bus_unwatch_name); - grd_context_set_mutter_screen_cast_proxy (daemon->context, NULL); - g_bus_unwatch_name (daemon->mutter_screen_cast_watch_name_id); - daemon->mutter_screen_cast_watch_name_id = 0; + grd_context_set_mutter_screen_cast_proxy (priv->context, NULL); + g_clear_handle_id (&priv->mutter_screen_cast_watch_name_id, g_bus_unwatch_name); - g_clear_object (&daemon->context); + g_clear_object (&priv->context); - if (daemon->sigterm_source) + if (priv->sigterm_source) { - g_source_destroy (daemon->sigterm_source); - g_clear_pointer (&daemon->sigterm_source, g_source_unref); + g_source_destroy (priv->sigterm_source); + g_clear_pointer (&priv->sigterm_source, g_source_unref); } - if (daemon->sigint_source) + if (priv->sigint_source) { - g_source_destroy (daemon->sigint_source); - g_clear_pointer (&daemon->sigint_source, g_source_unref); + g_source_destroy (priv->sigint_source); + g_clear_pointer (&priv->sigint_source, g_source_unref); } G_APPLICATION_CLASS (grd_daemon_parent_class)->shutdown (app); } +static void +grd_daemon_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GrdDaemon *daemon = GRD_DAEMON (object); + GrdDaemonPrivate *priv = grd_daemon_get_instance_private (daemon); + + switch (prop_id) + { + case PROP_CONTEXT: + g_value_set_object (value, priv->context); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + } +} + +static void +grd_daemon_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GrdDaemon *daemon = GRD_DAEMON (object); + GrdDaemonPrivate *priv = grd_daemon_get_instance_private (daemon); + + switch (prop_id) + { + case PROP_CONTEXT: + priv->context = g_value_get_object (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + } +} + static void grd_daemon_class_init (GrdDaemonClass *klass) { GApplicationClass *g_application_class = G_APPLICATION_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (klass); g_application_class->startup = grd_daemon_startup; g_application_class->shutdown = grd_daemon_shutdown; + + object_class->get_property = grd_daemon_get_property; + object_class->set_property = grd_daemon_set_property; + + g_object_class_install_property (object_class, + PROP_CONTEXT, + g_param_spec_object ("context", + "GrdContext", + "The GrdContext instance", + GRD_TYPE_CONTEXT, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS)); + + signals[MUTTER_PROXY_ACQUIRED] = g_signal_new ("mutter-proxy-acquired", + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + 0, + NULL, NULL, NULL, + G_TYPE_NONE, 0); + signals[RDP_SERVER_STARTED] = g_signal_new ("rdp-server-started", + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + 0, + NULL, NULL, NULL, + G_TYPE_NONE, 0); + signals[RDP_SERVER_STOPPED] = g_signal_new ("rdp-server-stopped", + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + 0, + NULL, NULL, NULL, + G_TYPE_NONE, 0); } static void @@ -416,9 +545,10 @@ static gboolean sigint_terminate_daemon (gpointer user_data) { GrdDaemon *daemon = user_data; + GrdDaemonPrivate *priv = grd_daemon_get_instance_private (daemon); g_debug ("Received SIGINT signal. Exiting..."); - g_clear_pointer (&daemon->sigint_source, g_source_unref); + g_clear_pointer (&priv->sigint_source, g_source_unref); g_application_release (G_APPLICATION (daemon)); return G_SOURCE_REMOVE; @@ -428,9 +558,10 @@ static gboolean sigterm_terminate_daemon (gpointer user_data) { GrdDaemon *daemon = user_data; + GrdDaemonPrivate *priv = grd_daemon_get_instance_private (daemon); g_debug ("Received SIGTERM signal. Exiting..."); - g_clear_pointer (&daemon->sigterm_source, g_source_unref); + g_clear_pointer (&priv->sigterm_source, g_source_unref); g_application_release (G_APPLICATION (daemon)); return G_SOURCE_REMOVE; @@ -439,55 +570,23 @@ sigterm_terminate_daemon (gpointer user_data) static void register_signals (GrdDaemon *daemon) { - daemon->sigint_source = g_unix_signal_source_new (SIGINT); - g_source_set_callback (daemon->sigint_source, sigint_terminate_daemon, - daemon, NULL); - g_source_attach (daemon->sigint_source, NULL); + GrdDaemonPrivate *priv = grd_daemon_get_instance_private (daemon); - daemon->sigterm_source = g_unix_signal_source_new (SIGTERM); - g_source_set_callback (daemon->sigterm_source, sigterm_terminate_daemon, + priv->sigint_source = g_unix_signal_source_new (SIGINT); + g_source_set_callback (priv->sigint_source, sigint_terminate_daemon, daemon, NULL); - g_source_attach (daemon->sigterm_source, NULL); -} - -static GrdDaemon * -grd_daemon_new (GrdRuntimeMode runtime_mode, - GError **error) -{ - GrdContext *context; - GrdDaemon *daemon; - GrdSettings *settings; - - context = grd_context_new (runtime_mode, error); - if (!context) - return NULL; + g_source_attach (priv->sigint_source, NULL); - daemon = g_object_new (GRD_TYPE_DAEMON, - "application-id", GRD_DAEMON_APPLICATION_ID, - "flags", G_APPLICATION_IS_SERVICE, - NULL); - - daemon->context = context; - - settings = grd_context_get_settings (daemon->context); - -#ifdef HAVE_RDP - g_signal_connect (settings, "rdp-enabled-changed", - G_CALLBACK (on_rdp_enabled_changed), - daemon); -#endif -#ifdef HAVE_VNC - g_signal_connect (settings, "vnc-enabled-changed", - G_CALLBACK (on_vnc_enabled_changed), - daemon); -#endif - - return daemon; + priv->sigterm_source = g_unix_signal_source_new (SIGTERM); + g_source_set_callback (priv->sigterm_source, sigterm_terminate_daemon, + daemon, NULL); + g_source_attach (priv->sigterm_source, NULL); } int main (int argc, char **argv) { + GrdContext *context; GrdSettings *settings; gboolean print_version = FALSE; gboolean headless = FALSE; @@ -505,16 +604,16 @@ main (int argc, char **argv) "VNC port", NULL }, { NULL } }; - g_autoptr(GOptionContext) context = NULL; + g_autoptr (GOptionContext) option_context = NULL; g_autoptr (GrdDaemon) daemon = NULL; GError *error = NULL; GrdRuntimeMode runtime_mode; g_set_application_name (_("GNOME Remote Desktop")); - context = g_option_context_new (NULL); - g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE); - if (!g_option_context_parse (context, &argc, &argv, &error)) + option_context = g_option_context_new (NULL); + g_option_context_add_main_entries (option_context, entries, GETTEXT_PACKAGE); + if (!g_option_context_parse (option_context, &argc, &argv, &error)) { g_printerr ("Invalid option: %s\n", error->message); g_error_free (error); @@ -532,7 +631,14 @@ main (int argc, char **argv) else runtime_mode = GRD_RUNTIME_MODE_SCREEN_SHARE; - daemon = grd_daemon_new (runtime_mode, &error); + switch (runtime_mode) + { + case GRD_RUNTIME_MODE_SCREEN_SHARE: + case GRD_RUNTIME_MODE_HEADLESS: + daemon = GRD_DAEMON (grd_daemon_user_new (runtime_mode, &error)); + break; + } + if (!daemon) { g_printerr ("Failed to initialize: %s\n", error->message); @@ -543,7 +649,8 @@ main (int argc, char **argv) add_actions (G_APPLICATION (daemon)); register_signals (daemon); - settings = grd_context_get_settings (daemon->context); + context = grd_daemon_get_context (daemon); + settings = grd_context_get_settings (context); if (rdp_port != -1) grd_settings_override_rdp_port (settings, rdp_port); if (vnc_port != -1) diff --git a/src/grd-daemon.h b/src/grd-daemon.h index 53324575..814cf950 100644 --- a/src/grd-daemon.h +++ b/src/grd-daemon.h @@ -25,13 +25,25 @@ #include -#include "grd-dbus-mutter-remote-desktop.h" +#include "grd-context.h" typedef struct _GrdDaemon GrdDaemon; #define GRD_TYPE_DAEMON (grd_daemon_get_type ()) -G_DECLARE_FINAL_TYPE (GrdDaemon, grd_daemon, GRD, DAEMON, GApplication) +G_DECLARE_DERIVABLE_TYPE (GrdDaemon, grd_daemon, GRD, DAEMON, GApplication) -GrdDBusMutterRemoteDesktop *grd_daemon_get_dbus_proxy (GrdDaemon *daemon); +struct _GrdDaemonClass +{ + GApplicationClass parent_class; + + gboolean (*is_daemon_ready) (GrdDaemon *daemon); +}; + +GrdContext *grd_daemon_get_context (GrdDaemon *daemon); + +void grd_daemon_maybe_enable_services (GrdDaemon *daemon); + +void grd_daemon_acquire_mutter_dbus_proxies (GrdDaemon *daemon, + GDBusConnection *connection); #endif /* GRD_DAEMON_H */ diff --git a/src/grd-private.h b/src/grd-private.h index 3c91f586..20bc6eff 100644 --- a/src/grd-private.h +++ b/src/grd-private.h @@ -23,7 +23,7 @@ #ifndef GRD_PRIVATE_H #define GRD_PRIVATE_H -#define GRD_DAEMON_APPLICATION_ID "org.gnome.RemoteDesktop" +#define GRD_DAEMON_USER_APPLICATION_ID "org.gnome.RemoteDesktop.User" #define MUTTER_REMOTE_DESKTOP_BUS_NAME "org.gnome.Mutter.RemoteDesktop" #define MUTTER_REMOTE_DESKTOP_OBJECT_PATH "/org/gnome/Mutter/RemoteDesktop" #define MUTTER_SCREEN_CAST_BUS_NAME "org.gnome.Mutter.ScreenCast" diff --git a/src/meson.build b/src/meson.build index 10bec4d8..3eda159f 100644 --- a/src/meson.build +++ b/src/meson.build @@ -41,6 +41,8 @@ daemon_sources = files([ 'grd-context.h', 'grd-daemon.c', 'grd-daemon.h', + 'grd-daemon-user.c', + 'grd-daemon-user.h', 'grd-damage-utils.c', 'grd-damage-utils.h', 'grd-debug.c', -- GitLab