[mutter] screen-cast-session: Add 'disable-animations' property



commit 81512ad0dc713cd4cc93c983c3f305fde32a375a
Author: Jonas Ådahl <jadahl gmail com>
Date:   Tue Sep 24 11:10:15 2019 +0200

    screen-cast-session: Add 'disable-animations' property
    
    Allow screen casters (e.g. VNC remote desktop services) to ask for
    animations to be inhibited, in order to lower the number of frames sent
    over the network.
    
    Currently only sets a field on the screen cast session object. Later
    it'll be exposed via the remote access handle and via D-Bus by
    gnome-shell.
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/838

 src/backends/meta-screen-cast-session.c |  9 +++++++++
 src/backends/meta-screen-cast-session.h |  3 +++
 src/backends/meta-screen-cast.c         | 10 +++++++++-
 src/org.gnome.Mutter.ScreenCast.xml     |  4 ++++
 4 files changed, 25 insertions(+), 1 deletion(-)
---
diff --git a/src/backends/meta-screen-cast-session.c b/src/backends/meta-screen-cast-session.c
index a9b861e8d..859d9328a 100644
--- a/src/backends/meta-screen-cast-session.c
+++ b/src/backends/meta-screen-cast-session.c
@@ -48,6 +48,8 @@ struct _MetaScreenCastSession
   GList *streams;
 
   MetaScreenCastSessionHandle *handle;
+
+  gboolean disable_animations;
 };
 
 static void
@@ -167,6 +169,13 @@ meta_screen_cast_session_get_screen_cast (MetaScreenCastSession *session)
   return session->screen_cast;
 }
 
+void
+meta_screen_cast_session_set_disable_animations (MetaScreenCastSession *session,
+                                                 gboolean               disable_animations)
+{
+  session->disable_animations = disable_animations;
+}
+
 char *
 meta_screen_cast_session_get_object_path (MetaScreenCastSession *session)
 {
diff --git a/src/backends/meta-screen-cast-session.h b/src/backends/meta-screen-cast-session.h
index ee02e4e2d..3bab3486b 100644
--- a/src/backends/meta-screen-cast-session.h
+++ b/src/backends/meta-screen-cast-session.h
@@ -64,4 +64,7 @@ MetaScreenCastStream * meta_screen_cast_session_get_stream (MetaScreenCastSessio
 
 MetaScreenCast * meta_screen_cast_session_get_screen_cast (MetaScreenCastSession *session);
 
+void meta_screen_cast_session_set_disable_animations (MetaScreenCastSession *session,
+                                                      gboolean               disable_animations);
+
 #endif /* META_SCREEN_CAST_SESSION_H */
diff --git a/src/backends/meta-screen-cast.c b/src/backends/meta-screen-cast.c
index 063fffd8e..b473aa8eb 100644
--- a/src/backends/meta-screen-cast.c
+++ b/src/backends/meta-screen-cast.c
@@ -32,7 +32,7 @@
 
 #define META_SCREEN_CAST_DBUS_SERVICE "org.gnome.Mutter.ScreenCast"
 #define META_SCREEN_CAST_DBUS_PATH "/org/gnome/Mutter/ScreenCast"
-#define META_SCREEN_CAST_API_VERSION 2
+#define META_SCREEN_CAST_API_VERSION 3
 
 struct _MetaScreenCast
 {
@@ -116,6 +116,7 @@ handle_create_session (MetaDBusScreenCast    *skeleton,
   const char *session_path;
   const char *client_dbus_name;
   char *remote_desktop_session_id = NULL;
+  gboolean disable_animations;
   MetaScreenCastSessionType session_type;
 
   g_variant_lookup (properties, "remote-desktop-session-id", "s",
@@ -160,6 +161,13 @@ handle_create_session (MetaDBusScreenCast    *skeleton,
         }
     }
 
+  if (g_variant_lookup (properties, "disable-animations", "b",
+                        &disable_animations))
+    {
+      meta_screen_cast_session_set_disable_animations (session,
+                                                       disable_animations);
+    }
+
   client_dbus_name = g_dbus_method_invocation_get_sender (invocation);
   meta_dbus_session_watcher_watch_session (screen_cast->session_watcher,
                                            client_dbus_name,
diff --git a/src/org.gnome.Mutter.ScreenCast.xml b/src/org.gnome.Mutter.ScreenCast.xml
index 0e83747f5..1d9fa598e 100644
--- a/src/org.gnome.Mutter.ScreenCast.xml
+++ b/src/org.gnome.Mutter.ScreenCast.xml
@@ -22,6 +22,10 @@
                                           Remote desktop driven screen casts
                                           are started and stopped by the remote
                                           desktop session.
+       * "disable-animations" (b): Set to "true" if the screen cast application
+                                   would prefer animations to be globally
+                                   disabled, while the session is running. Default
+                                   is "false". Available since version 3.
     -->
     <method name="CreateSession">
       <arg name="properties" type="a{sv}" direction="in" />


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]