From 8a1c0f3a4212f581fd90aab9d11f05d5fba9e0e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Tue, 1 Oct 2019 12:04:52 +0200 Subject: [PATCH] main: Inhibit animations when there is a remote desktop session If a remote desktop session asks for animations to be disabled, inhibit animations while the session is active. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/757 --- js/ui/main.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/js/ui/main.js b/js/ui/main.js index 65cbbd3ac..05b30d544 100644 --- a/js/ui/main.js +++ b/js/ui/main.js @@ -775,5 +775,31 @@ var AnimationsSettings = class { St.Settings.get().inhibit_animations(); return; } + + let remoteAccessController = backend.get_remote_access_controller(); + if (!remoteAccessController) + return; + + this._handles = new Set(); + remoteAccessController.connect('new-handle', + (_, handle) => this._onNewRemoteAccessHandle(handle)); + } + + _onRemoteAccessHandleStopped(handle) { + let settings = St.Settings.get(); + + settings.uninhibit_animations(); + this._handles.delete(handle); + } + + _onNewRemoteAccessHandle(handle) { + if (!handle.get_disable_animations()) + return; + + let settings = St.Settings.get(); + + settings.inhibit_animations(); + this._handles.add(handle); + handle.connect('stopped', this._onRemoteAccessHandleStopped.bind(this)); } };