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
This commit is contained in:
Jonas Ådahl 2019-09-24 11:10:15 +02:00
parent d122b66abc
commit 81512ad0dc
4 changed files with 25 additions and 1 deletions

View File

@ -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)
{

View File

@ -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 */

View File

@ -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,

View File

@ -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" />