From 8c1e6ebde0d97cd3484c8f953b8641c4bb0b7634 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Tue, 24 Sep 2019 11:11:48 +0200 Subject: [PATCH] remote-access-handle: Expose disable-animations property Set to TRUE if a screen cast session asked for animations to be disabled. https://gitlab.gnome.org/GNOME/mutter/merge_requests/838 --- .../meta-remote-access-controller-private.h | 3 ++ src/backends/meta-remote-access-controller.c | 28 +++++++++++++++++++ src/backends/meta-screen-cast-session.c | 4 +++ src/meta/meta-remote-access-controller.h | 3 ++ 4 files changed, 38 insertions(+) diff --git a/src/backends/meta-remote-access-controller-private.h b/src/backends/meta-remote-access-controller-private.h index fce2082bf..81477057c 100644 --- a/src/backends/meta-remote-access-controller-private.h +++ b/src/backends/meta-remote-access-controller-private.h @@ -28,4 +28,7 @@ void meta_remote_access_controller_notify_new_handle (MetaRemoteAccessController void meta_remote_access_handle_notify_stopped (MetaRemoteAccessHandle *handle); +void meta_remote_access_handle_set_disable_animations (MetaRemoteAccessHandle *handle, + gboolean disable_animations); + #endif /* META_REMOTE_ACCESS_CONTROLLER_PRIVATE_H */ diff --git a/src/backends/meta-remote-access-controller.c b/src/backends/meta-remote-access-controller.c index 0e0ebe2bd..e9b2a70f6 100644 --- a/src/backends/meta-remote-access-controller.c +++ b/src/backends/meta-remote-access-controller.c @@ -43,6 +43,8 @@ static int controller_signals[N_CONTROLLER_SIGNALS]; typedef struct _MetaRemoteAccessHandlePrivate { gboolean has_stopped; + + gboolean disable_animations; } MetaRemoteAccessHandlePrivate; G_DEFINE_TYPE_WITH_PRIVATE (MetaRemoteAccessHandle, @@ -76,6 +78,32 @@ meta_remote_access_handle_stop (MetaRemoteAccessHandle *handle) META_REMOTE_ACCESS_HANDLE_GET_CLASS (handle)->stop (handle); } +/** + * meta_remote_access_get_disable_animations: + * @handle: A #MetaRemoteAccessHandle + * + * Returns: %TRUE if the remote access requested that animations should be + * disabled. + */ +gboolean +meta_remote_access_handle_get_disable_animations (MetaRemoteAccessHandle *handle) +{ + MetaRemoteAccessHandlePrivate *priv = + meta_remote_access_handle_get_instance_private (handle); + + return priv->disable_animations; +} + +void +meta_remote_access_handle_set_disable_animations (MetaRemoteAccessHandle *handle, + gboolean disable_animations) +{ + MetaRemoteAccessHandlePrivate *priv = + meta_remote_access_handle_get_instance_private (handle); + + priv->disable_animations = disable_animations; +} + void meta_remote_access_handle_notify_stopped (MetaRemoteAccessHandle *handle) { diff --git a/src/backends/meta-screen-cast-session.c b/src/backends/meta-screen-cast-session.c index 859d9328a..7a1b8e07a 100644 --- a/src/backends/meta-screen-cast-session.c +++ b/src/backends/meta-screen-cast-session.c @@ -91,6 +91,10 @@ init_remote_access_handle (MetaScreenCastSession *session) remote_access_controller = meta_backend_get_remote_access_controller (backend); remote_access_handle = META_REMOTE_ACCESS_HANDLE (session->handle); + + meta_remote_access_handle_set_disable_animations (remote_access_handle, + session->disable_animations); + meta_remote_access_controller_notify_new_handle (remote_access_controller, remote_access_handle); } diff --git a/src/meta/meta-remote-access-controller.h b/src/meta/meta-remote-access-controller.h index e7c707bbc..939566a36 100644 --- a/src/meta/meta-remote-access-controller.h +++ b/src/meta/meta-remote-access-controller.h @@ -43,6 +43,9 @@ struct _MetaRemoteAccessHandleClass META_EXPORT void meta_remote_access_handle_stop (MetaRemoteAccessHandle *handle); +META_EXPORT +gboolean meta_remote_access_handle_get_disable_animations (MetaRemoteAccessHandle *handle); + #define META_TYPE_REMOTE_ACCESS_CONTROLLER meta_remote_access_controller_get_type () META_EXPORT