Blame SOURCES/introspect-backports.patch

5731ec
From 781dfcf6ce7168c6b116d58df5f1c67291a7b513 Mon Sep 17 00:00:00 2001
5731ec
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
5731ec
Date: Thu, 16 May 2019 00:57:27 +0200
5731ec
Subject: [PATCH 01/11] introspect: Include `sandboxed-app-id` as well
5731ec
5731ec
App IDs in gnome-shell don't match AppStream, Flatpak or Snap IDs. For the
5731ec
desktop portal, the latter two are more relevant, so include it in the
5731ec
returned information.
5731ec
5731ec
https://gitlab.gnome.org/GNOME/gnome-shell/issues/1289
5731ec
---
5731ec
 js/misc/introspect.js | 14 ++++++++++++++
5731ec
 1 file changed, 14 insertions(+)
5731ec
5731ec
diff --git a/js/misc/introspect.js b/js/misc/introspect.js
5731ec
index f7a7f2fe6..1e8300d0a 100644
5731ec
--- a/js/misc/introspect.js
5731ec
+++ b/js/misc/introspect.js
5731ec
@@ -55,6 +55,11 @@ var IntrospectService = class {
5731ec
        return APP_WHITELIST.includes(sender);
5731ec
     }
5731ec
 
5731ec
+    _getSandboxedAppId(app) {
5731ec
+        let ids = app.get_windows().map(w => w.get_sandboxed_app_id());
5731ec
+        return ids.find(id => id != null);
5731ec
+    }
5731ec
+
5731ec
     _syncRunningApplications() {
5731ec
         let tracker = Shell.WindowTracker.get_default();
5731ec
         let apps = this._appSystem.get_running();
5731ec
@@ -76,6 +81,10 @@ var IntrospectService = class {
5731ec
                 newActiveApplication = app.get_id();
5731ec
             }
5731ec
 
5731ec
+            let sandboxedAppId = this._getSandboxedAppId(app);
5731ec
+            if (sandboxedAppId)
5731ec
+                appInfo['sandboxed-app-id'] = new GLib.Variant('s', sandboxedAppId);
5731ec
+
5731ec
             newRunningApplications[app.get_id()] = appInfo;
5731ec
         }
5731ec
 
5731ec
@@ -137,6 +146,7 @@ var IntrospectService = class {
5731ec
                 let frameRect = window.get_frame_rect();
5731ec
                 let title = window.get_title();
5731ec
                 let wmClass = window.get_wm_class();
5731ec
+                let sandboxedAppId = window.get_sandboxed_app_id();
5731ec
 
5731ec
                 windowsList[windowId] = {
5731ec
                     'app-id': GLib.Variant.new('s', app.get_id()),
5731ec
@@ -153,6 +163,10 @@ var IntrospectService = class {
5731ec
 
5731ec
                 if (wmClass != null)
5731ec
                     windowsList[windowId]['wm-class'] = GLib.Variant.new('s', wmClass);
5731ec
+
5731ec
+                if (sandboxedAppId != null)
5731ec
+                    windowsList[windowId]['sandboxed-app-id'] =
5731ec
+                        GLib.Variant.new('s', sandboxedAppId);
5731ec
             }
5731ec
         }
5731ec
         invocation.return_value(new GLib.Variant('(a{ta{sv}})', [windowsList]));
5731ec
-- 
5731ec
2.26.2
5731ec
5731ec
5731ec
From b0b4fb82c058722e2171d24902ba3855ffe243f3 Mon Sep 17 00:00:00 2001
5731ec
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
5731ec
Date: Wed, 18 Sep 2019 14:57:48 +0200
5731ec
Subject: [PATCH 02/11] introspect: Check whitelist also for
5731ec
 GetRunningWindows()
5731ec
5731ec
Otherwise the xdg-desktop-portal-gtk screen cast widget won't work.
5731ec
5731ec
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/732
5731ec
---
5731ec
 js/misc/introspect.js | 3 ++-
5731ec
 1 file changed, 2 insertions(+), 1 deletion(-)
5731ec
5731ec
diff --git a/js/misc/introspect.js b/js/misc/introspect.js
5731ec
index 1e8300d0a..cee6409a8 100644
5731ec
--- a/js/misc/introspect.js
5731ec
+++ b/js/misc/introspect.js
5731ec
@@ -128,7 +128,8 @@ var IntrospectService = class {
5731ec
         let apps = this._appSystem.get_running();
5731ec
         let windowsList = {};
5731ec
 
5731ec
-        if (!this._isIntrospectEnabled()) {
5731ec
+        if (!this._isIntrospectEnabled() &&
5731ec
+            !this._isSenderWhitelisted(invocation.get_sender())) {
5731ec
             invocation.return_error_literal(Gio.DBusError,
5731ec
                                             Gio.DBusError.ACCESS_DENIED,
5731ec
                                             'App introspection not allowed');
5731ec
-- 
5731ec
2.26.2
5731ec
5731ec
5731ec
From 23556e03db3743ddf478a3c1bbb64946c687afdf Mon Sep 17 00:00:00 2001
5731ec
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
5731ec
Date: Mon, 25 Nov 2019 19:44:10 +0100
5731ec
Subject: [PATCH 03/11] introspect: Fix whitelist check
5731ec
5731ec
The whitelist is a list of well-known D-Bus names, which we then search
5731ec
for the unique name we get from the method invocation - unsuccesfully.
5731ec
5731ec
Fix this by watching the bus for any name in the whitelist in order
5731ec
to maintain a map from wel-known to unique name that we can use for
5731ec
matching.
5731ec
5731ec
https://gitlab.gnome.org/GNOME/gnome-shell/issues/1916
5731ec
---
5731ec
 js/misc/introspect.js | 11 ++++++++++-
5731ec
 1 file changed, 10 insertions(+), 1 deletion(-)
5731ec
5731ec
diff --git a/js/misc/introspect.js b/js/misc/introspect.js
5731ec
index cee6409a8..f14eabfad 100644
5731ec
--- a/js/misc/introspect.js
5731ec
+++ b/js/misc/introspect.js
5731ec
@@ -39,6 +39,15 @@ var IntrospectService = class {
5731ec
                         });
5731ec
 
5731ec
         this._syncRunningApplications();
5731ec
+
5731ec
+        this._whitelistMap = new Map();
5731ec
+        APP_WHITELIST.forEach(appName => {
5731ec
+            Gio.DBus.watch_name(Gio.BusType.SESSION,
5731ec
+                appName,
5731ec
+                Gio.BusNameWatcherFlags.NONE,
5731ec
+                (conn, name, owner) => this._whitelistMap.set(name, owner),
5731ec
+                (conn, name) => this._whitelistMap.delete(name));
5731ec
+        });
5731ec
     }
5731ec
 
5731ec
     _isStandaloneApp(app) {
5731ec
@@ -52,7 +61,7 @@ var IntrospectService = class {
5731ec
     }
5731ec
 
5731ec
     _isSenderWhitelisted(sender) {
5731ec
-       return APP_WHITELIST.includes(sender);
5731ec
+        return [...this._whitelistMap.values()].includes(sender);
5731ec
     }
5731ec
 
5731ec
     _getSandboxedAppId(app) {
5731ec
-- 
5731ec
2.26.2
5731ec
5731ec
5731ec
From 1a6275add6d214df958ed8a06c097445bef021bc Mon Sep 17 00:00:00 2001
5731ec
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
5731ec
Date: Wed, 25 Sep 2019 20:36:28 +0200
5731ec
Subject: [PATCH 04/11] introspect: Add helper to check method call permission
5731ec
5731ec
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/757
5731ec
---
5731ec
 js/misc/introspect.js | 16 ++++++++++++----
5731ec
 1 file changed, 12 insertions(+), 4 deletions(-)
5731ec
5731ec
diff --git a/js/misc/introspect.js b/js/misc/introspect.js
5731ec
index f14eabfad..6186754cd 100644
5731ec
--- a/js/misc/introspect.js
5731ec
+++ b/js/misc/introspect.js
5731ec
@@ -120,9 +120,18 @@ var IntrospectService = class {
5731ec
                 type == Meta.WindowType.UTILITY);
5731ec
     }
5731ec
 
5731ec
+    _isInvocationAllowed(invocation) {
5731ec
+        if (this._isIntrospectEnabled())
5731ec
+            return true;
5731ec
+
5731ec
+        if (this._isSenderWhitelisted(invocation.get_sender()))
5731ec
+            return true;
5731ec
+
5731ec
+        return false;
5731ec
+    }
5731ec
+
5731ec
     GetRunningApplicationsAsync(params, invocation) {
5731ec
-        if (!this._isIntrospectEnabled() &&
5731ec
-            !this._isSenderWhitelisted(invocation.get_sender())) {
5731ec
+        if (!this._isInvocationAllowed(invocation)) {
5731ec
             invocation.return_error_literal(Gio.DBusError,
5731ec
                                             Gio.DBusError.ACCESS_DENIED,
5731ec
                                             'App introspection not allowed');
5731ec
@@ -137,8 +146,7 @@ var IntrospectService = class {
5731ec
         let apps = this._appSystem.get_running();
5731ec
         let windowsList = {};
5731ec
 
5731ec
-        if (!this._isIntrospectEnabled() &&
5731ec
-            !this._isSenderWhitelisted(invocation.get_sender())) {
5731ec
+        if (!this._isInvocationAllowed(invocation)) {
5731ec
             invocation.return_error_literal(Gio.DBusError,
5731ec
                                             Gio.DBusError.ACCESS_DENIED,
5731ec
                                             'App introspection not allowed');
5731ec
-- 
5731ec
2.26.2
5731ec
5731ec
5731ec
From f578dc01cf774faa4504a4d258cc0e82060d988b Mon Sep 17 00:00:00 2001
5731ec
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
5731ec
Date: Tue, 1 Oct 2019 11:55:33 +0200
5731ec
Subject: [PATCH 05/11] shell-util: Add API to check for X11 extensions
5731ec
5731ec
Will be used to disable animations when running inside Xvnc. This was
5731ec
done in gsd-xsettings before.
5731ec
5731ec
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/757
5731ec
---
5731ec
 src/shell-util.c | 26 ++++++++++++++++++++++++++
5731ec
 src/shell-util.h |  3 +++
5731ec
 2 files changed, 29 insertions(+)
5731ec
5731ec
diff --git a/src/shell-util.c b/src/shell-util.c
5731ec
index 31bb18e70..fa3fc08c8 100644
5731ec
--- a/src/shell-util.c
5731ec
+++ b/src/shell-util.c
5731ec
@@ -21,6 +21,8 @@
5731ec
 #include <gtk/gtk.h>
5731ec
 #include <gdk-pixbuf/gdk-pixbuf.h>
5731ec
 #include <meta/meta-shaped-texture.h>
5731ec
+#include <meta/display.h>
5731ec
+#include <meta/meta-x11-display.h>
5731ec
 
5731ec
 #include <locale.h>
5731ec
 #ifdef HAVE__NL_TIME_FIRST_WEEKDAY
5731ec
@@ -613,3 +615,27 @@ shell_util_check_cloexec_fds (void)
5731ec
   fdwalk (check_cloexec, NULL);
5731ec
   g_info ("Open fd CLOEXEC check complete");
5731ec
 }
5731ec
+
5731ec
+/**
5731ec
+ * shell_util_has_x11_display_extension:
5731ec
+ * @display: A #MetaDisplay
5731ec
+ * @extension: An X11 extension
5731ec
+ *
5731ec
+ * If the corresponding X11 display provides the passed extension, return %TRUE,
5731ec
+ * otherwise %FALSE. If there is no X11 display, %FALSE is passed.
5731ec
+ */
5731ec
+gboolean
5731ec
+shell_util_has_x11_display_extension (MetaDisplay *display,
5731ec
+                                      const char  *extension)
5731ec
+{
5731ec
+  MetaX11Display *x11_display;
5731ec
+  Display *xdisplay;
5731ec
+  int op, event, error;
5731ec
+
5731ec
+  x11_display = meta_display_get_x11_display (display);
5731ec
+  if (!x11_display)
5731ec
+    return FALSE;
5731ec
+
5731ec
+  xdisplay = meta_x11_display_get_xdisplay (x11_display);
5731ec
+  return XQueryExtension (xdisplay, extension, &op, &event, &error);
5731ec
+}
5731ec
diff --git a/src/shell-util.h b/src/shell-util.h
5731ec
index 6904f43bc..02b8404e9 100644
5731ec
--- a/src/shell-util.h
5731ec
+++ b/src/shell-util.h
5731ec
@@ -59,6 +59,9 @@ cairo_surface_t * shell_util_composite_capture_images (ClutterCapture  *captures
5731ec
 
5731ec
 void shell_util_check_cloexec_fds (void);
5731ec
 
5731ec
+gboolean shell_util_has_x11_display_extension (MetaDisplay *display,
5731ec
+                                               const char  *extension);
5731ec
+
5731ec
 G_END_DECLS
5731ec
 
5731ec
 #endif /* __SHELL_UTIL_H__ */
5731ec
-- 
5731ec
2.26.2
5731ec
5731ec
5731ec
From 48ee79bb7b48c7e93e77e35629f21bbdbabc253f Mon Sep 17 00:00:00 2001
5731ec
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
5731ec
Date: Tue, 1 Oct 2019 11:56:34 +0200
5731ec
Subject: [PATCH 06/11] st/settings: Add API to inhibit animations
5731ec
5731ec
There may be situations where we shouldn't enable animations. Make it
5731ec
possible for the Shell to decide when there are such situations and in
5731ec
when needed inhibit animations.
5731ec
5731ec
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/757
5731ec
---
5731ec
 src/st/st-settings.c | 38 +++++++++++++++++++++++++++++++++++++-
5731ec
 src/st/st-settings.h |  4 ++++
5731ec
 2 files changed, 41 insertions(+), 1 deletion(-)
5731ec
5731ec
diff --git a/src/st/st-settings.c b/src/st/st-settings.c
5731ec
index 17f2c466e..ebfd28480 100644
5731ec
--- a/src/st/st-settings.c
5731ec
+++ b/src/st/st-settings.c
5731ec
@@ -54,6 +54,7 @@ struct _StSettings
5731ec
 
5731ec
   gchar *gtk_theme;
5731ec
   gchar *gtk_icon_theme;
5731ec
+  int inhibit_animations_count;
5731ec
   gboolean enable_animations;
5731ec
   gboolean primary_paste;
5731ec
   gboolean magnifier_active;
5731ec
@@ -62,6 +63,41 @@ struct _StSettings
5731ec
 
5731ec
 G_DEFINE_TYPE (StSettings, st_settings, G_TYPE_OBJECT)
5731ec
 
5731ec
+static gboolean
5731ec
+get_enable_animations (StSettings *settings)
5731ec
+{
5731ec
+  if (settings->inhibit_animations_count > 0)
5731ec
+    return FALSE;
5731ec
+  else
5731ec
+    return settings->enable_animations;
5731ec
+}
5731ec
+
5731ec
+void
5731ec
+st_settings_inhibit_animations (StSettings *settings)
5731ec
+{
5731ec
+  gboolean enable_animations;
5731ec
+
5731ec
+  enable_animations = get_enable_animations (settings);
5731ec
+  settings->inhibit_animations_count++;
5731ec
+
5731ec
+  if (enable_animations != get_enable_animations (settings))
5731ec
+    g_object_notify_by_pspec (G_OBJECT (settings),
5731ec
+                              props[PROP_ENABLE_ANIMATIONS]);
5731ec
+}
5731ec
+
5731ec
+void
5731ec
+st_settings_uninhibit_animations (StSettings *settings)
5731ec
+{
5731ec
+  gboolean enable_animations;
5731ec
+
5731ec
+  enable_animations = get_enable_animations (settings);
5731ec
+  settings->inhibit_animations_count--;
5731ec
+
5731ec
+  if (enable_animations != get_enable_animations (settings))
5731ec
+    g_object_notify_by_pspec (G_OBJECT (settings),
5731ec
+                              props[PROP_ENABLE_ANIMATIONS]);
5731ec
+}
5731ec
+
5731ec
 static void
5731ec
 st_settings_finalize (GObject *object)
5731ec
 {
5731ec
@@ -95,7 +131,7 @@ st_settings_get_property (GObject    *object,
5731ec
   switch (prop_id)
5731ec
     {
5731ec
     case PROP_ENABLE_ANIMATIONS:
5731ec
-      g_value_set_boolean (value, settings->enable_animations);
5731ec
+      g_value_set_boolean (value, get_enable_animations (settings));
5731ec
       break;
5731ec
     case PROP_PRIMARY_PASTE:
5731ec
       g_value_set_boolean (value, settings->primary_paste);
5731ec
diff --git a/src/st/st-settings.h b/src/st/st-settings.h
5731ec
index c2c4fa23e..8b2549469 100644
5731ec
--- a/src/st/st-settings.h
5731ec
+++ b/src/st/st-settings.h
5731ec
@@ -33,6 +33,10 @@ G_DECLARE_FINAL_TYPE (StSettings, st_settings, ST, SETTINGS, GObject)
5731ec
 
5731ec
 StSettings * st_settings_get (void);
5731ec
 
5731ec
+void st_settings_inhibit_animations (StSettings *settings);
5731ec
+
5731ec
+void st_settings_uninhibit_animations (StSettings *settings);
5731ec
+
5731ec
 G_END_DECLS
5731ec
 
5731ec
 #endif /* __ST_SETTINGS_H__ */
5731ec
-- 
5731ec
2.26.2
5731ec
5731ec
5731ec
From 80025388c44296b629c8f24ea673d77ffc4efc67 Mon Sep 17 00:00:00 2001
5731ec
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
5731ec
Date: Tue, 1 Oct 2019 12:02:31 +0200
5731ec
Subject: [PATCH 07/11] main: Inhibit animations when software rendered
5731ec
5731ec
This was previously decided by gsd-xsettings.
5731ec
5731ec
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/757
5731ec
---
5731ec
 js/ui/main.js | 12 ++++++++++++
5731ec
 1 file changed, 12 insertions(+)
5731ec
5731ec
diff --git a/js/ui/main.js b/js/ui/main.js
5731ec
index 978f83c3f..c3230ff03 100644
5731ec
--- a/js/ui/main.js
5731ec
+++ b/js/ui/main.js
5731ec
@@ -147,6 +147,8 @@ function _initializeUI() {
5731ec
     _loadOskLayouts();
5731ec
     _loadDefaultStylesheet();
5731ec
 
5731ec
+    new AnimationsSettings();
5731ec
+
5731ec
     // Setup the stage hierarchy early
5731ec
     layoutManager = new Layout.LayoutManager();
5731ec
 
5731ec
@@ -723,3 +725,13 @@ function showRestartMessage(message) {
5731ec
     let restartMessage = new RestartMessage(message);
5731ec
     restartMessage.open();
5731ec
 }
5731ec
+
5731ec
+var AnimationsSettings = class {
5731ec
+    constructor() {
5731ec
+        let backend = Meta.get_backend();
5731ec
+        if (!backend.is_rendering_hardware_accelerated()) {
5731ec
+            St.Settings.get().inhibit_animations();
5731ec
+            return;
5731ec
+        }
5731ec
+    }
5731ec
+};
5731ec
-- 
5731ec
2.26.2
5731ec
5731ec
5731ec
From 788ecb60e35d8a369f0747813f37e8b1ca27cb87 Mon Sep 17 00:00:00 2001
5731ec
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
5731ec
Date: Tue, 1 Oct 2019 12:03:52 +0200
5731ec
Subject: [PATCH 08/11] main: Inhibit animations if X server advertises
5731ec
 VNC-EXTENSION
5731ec
5731ec
This was previously done by gsd-xsettings to disable animations when
5731ec
running in Xvnc.
5731ec
5731ec
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/757
5731ec
---
5731ec
 js/ui/main.js | 7 +++++++
5731ec
 1 file changed, 7 insertions(+)
5731ec
5731ec
diff --git a/js/ui/main.js b/js/ui/main.js
5731ec
index c3230ff03..ae7c3ffd0 100644
5731ec
--- a/js/ui/main.js
5731ec
+++ b/js/ui/main.js
5731ec
@@ -733,5 +733,12 @@ var AnimationsSettings = class {
5731ec
             St.Settings.get().inhibit_animations();
5731ec
             return;
5731ec
         }
5731ec
+
5731ec
+        let isXvnc = Shell.util_has_x11_display_extension(
5731ec
+            global.display, 'VNC-EXTENSION');
5731ec
+        if (isXvnc) {
5731ec
+            St.Settings.get().inhibit_animations();
5731ec
+            return;
5731ec
+        }
5731ec
     }
5731ec
 };
5731ec
-- 
5731ec
2.26.2
5731ec
5731ec
5731ec
From 1da5a7ce4cf0b95b96dd50b62ac6c1380fd88cb1 Mon Sep 17 00:00:00 2001
5731ec
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
5731ec
Date: Tue, 1 Oct 2019 12:04:52 +0200
5731ec
Subject: [PATCH 09/11] main: Inhibit animations when there is a remote desktop
5731ec
 session
5731ec
5731ec
If a remote desktop session asks for animations to be disabled, inhibit
5731ec
animations while the session is active.
5731ec
5731ec
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/757
5731ec
---
5731ec
 js/ui/main.js | 26 ++++++++++++++++++++++++++
5731ec
 1 file changed, 26 insertions(+)
5731ec
5731ec
diff --git a/js/ui/main.js b/js/ui/main.js
5731ec
index ae7c3ffd0..1203b3c39 100644
5731ec
--- a/js/ui/main.js
5731ec
+++ b/js/ui/main.js
5731ec
@@ -740,5 +740,31 @@ var AnimationsSettings = class {
5731ec
             St.Settings.get().inhibit_animations();
5731ec
             return;
5731ec
         }
5731ec
+
5731ec
+        let remoteAccessController = backend.get_remote_access_controller();
5731ec
+        if (!remoteAccessController)
5731ec
+            return;
5731ec
+
5731ec
+        this._handles = new Set();
5731ec
+        remoteAccessController.connect('new-handle',
5731ec
+            (_, handle) => this._onNewRemoteAccessHandle(handle));
5731ec
+    }
5731ec
+
5731ec
+    _onRemoteAccessHandleStopped(handle) {
5731ec
+        let settings = St.Settings.get();
5731ec
+
5731ec
+        settings.uninhibit_animations();
5731ec
+        this._handles.delete(handle);
5731ec
+    }
5731ec
+
5731ec
+    _onNewRemoteAccessHandle(handle) {
5731ec
+        if (!handle.get_disable_animations())
5731ec
+            return;
5731ec
+
5731ec
+        let settings = St.Settings.get();
5731ec
+
5731ec
+        settings.inhibit_animations();
5731ec
+        this._handles.add(handle);
5731ec
+        handle.connect('stopped', this._onRemoteAccessHandleStopped.bind(this));
5731ec
     }
5731ec
 };
5731ec
-- 
5731ec
2.26.2
5731ec
5731ec
5731ec
From ebfd46341a2d7a6338386e4be4a2807a6bc6e63c Mon Sep 17 00:00:00 2001
5731ec
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
5731ec
Date: Tue, 1 Oct 2019 12:06:13 +0200
5731ec
Subject: [PATCH 10/11] introspect: Rename variable
5731ec
5731ec
It was too generic, and would conflict with a StSettings variable.
5731ec
5731ec
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/757
5731ec
---
5731ec
 js/misc/introspect.js | 6 ++++--
5731ec
 1 file changed, 4 insertions(+), 2 deletions(-)
5731ec
5731ec
diff --git a/js/misc/introspect.js b/js/misc/introspect.js
5731ec
index 6186754cd..8e68a7e4f 100644
5731ec
--- a/js/misc/introspect.js
5731ec
+++ b/js/misc/introspect.js
5731ec
@@ -29,7 +29,9 @@ var IntrospectService = class {
5731ec
                                     this._syncRunningApplications();
5731ec
                                 });
5731ec
 
5731ec
-        this._settings = new Gio.Settings({ schema_id: INTROSPECT_SCHEMA });
5731ec
+        this._introspectSettings = new Gio.Settings({
5731ec
+            schema_id: INTROSPECT_SCHEMA,
5731ec
+        });
5731ec
 
5731ec
         let tracker = Shell.WindowTracker.get_default();
5731ec
         tracker.connect('notify::focus-app',
5731ec
@@ -57,7 +59,7 @@ var IntrospectService = class {
5731ec
     }
5731ec
 
5731ec
     _isIntrospectEnabled() {
5731ec
-       return this._settings.get_boolean(INTROSPECT_KEY);
5731ec
+        return this._introspectSettings.get_boolean(INTROSPECT_KEY);
5731ec
     }
5731ec
 
5731ec
     _isSenderWhitelisted(sender) {
5731ec
-- 
5731ec
2.26.2
5731ec
5731ec
5731ec
From 343e7792fc84c296b331c3fcb142ed79d2ce9bd5 Mon Sep 17 00:00:00 2001
5731ec
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
5731ec
Date: Tue, 1 Oct 2019 12:07:03 +0200
5731ec
Subject: [PATCH 11/11] introspect: Add AnimationsEnabled property
5731ec
5731ec
While the gsetting is available for all who needs it, the Shell might
5731ec
override it given various hueristics. Expose the decision made by the
5731ec
Shell via a new property.
5731ec
5731ec
Intended to be used by gsd-xsettings as well as xdg-desktop-portal-gtk.
5731ec
5731ec
This also add a version property to the API, so that semi external
5731ec
services (xdg-desktop-portal-gtk) can detect what API is expected to be
5731ec
present.
5731ec
5731ec
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/757
5731ec
---
5731ec
 .../org.gnome.Shell.Introspect.xml            | 14 ++++++++++
5731ec
 js/misc/introspect.js                         | 27 ++++++++++++++++++-
5731ec
 2 files changed, 40 insertions(+), 1 deletion(-)
5731ec
5731ec
diff --git a/data/dbus-interfaces/org.gnome.Shell.Introspect.xml b/data/dbus-interfaces/org.gnome.Shell.Introspect.xml
5731ec
index 9508681af..d71f2414b 100644
5731ec
--- a/data/dbus-interfaces/org.gnome.Shell.Introspect.xml
5731ec
+++ b/data/dbus-interfaces/org.gnome.Shell.Introspect.xml
5731ec
@@ -57,5 +57,19 @@
5731ec
     <method name="GetWindows">
5731ec
       <arg name="windows" direction="out" type="a{ta{sv}}" />
5731ec
     </method>
5731ec
+
5731ec
+    
5731ec
+       AnimationsEnabled:
5731ec
+       @short_description: Whether the shell animations are enabled
5731ec
+
5731ec
+       By default determined by the org.gnome.desktop.interface enable-animations
5731ec
+       gsetting, but may be overridden, e.g. if there is an active screen cast or
5731ec
+       remote desktop session that asked for animations to be disabled.
5731ec
+
5731ec
+       Since: 2
5731ec
+    -->
5731ec
+    <property name="AnimationsEnabled" type="b" access="read"/>
5731ec
+
5731ec
+    <property name="version" type="u" access="read"/>
5731ec
   </interface>
5731ec
 </node>
5731ec
diff --git a/js/misc/introspect.js b/js/misc/introspect.js
5731ec
index 8e68a7e4f..7c62113e5 100644
5731ec
--- a/js/misc/introspect.js
5731ec
+++ b/js/misc/introspect.js
5731ec
@@ -1,9 +1,11 @@
5731ec
-const { Gio, GLib, Meta, Shell } = imports.gi;
5731ec
+const { Gio, GLib, Meta, Shell, St } = imports.gi;
5731ec
 
5731ec
 const INTROSPECT_SCHEMA = 'org.gnome.shell';
5731ec
 const INTROSPECT_KEY = 'introspect';
5731ec
 const APP_WHITELIST = ['org.freedesktop.impl.portal.desktop.gtk'];
5731ec
 
5731ec
+const INTROSPECT_DBUS_API_VERSION = 2;
5731ec
+
5731ec
 const { loadInterfaceXML } = imports.misc.fileUtils;
5731ec
 
5731ec
 const IntrospectDBusIface = loadInterfaceXML('org.gnome.Shell.Introspect');
5731ec
@@ -21,6 +23,7 @@ var IntrospectService = class {
5731ec
         this._runningApplicationsDirty = true;
5731ec
         this._activeApplication = null;
5731ec
         this._activeApplicationDirty = true;
5731ec
+        this._animationsEnabled = true;
5731ec
 
5731ec
         this._appSystem = Shell.AppSystem.get_default();
5731ec
         this._appSystem.connect('app-state-changed',
5731ec
@@ -50,6 +53,11 @@ var IntrospectService = class {
5731ec
                 (conn, name, owner) => this._whitelistMap.set(name, owner),
5731ec
                 (conn, name) => this._whitelistMap.delete(name));
5731ec
         });
5731ec
+
5731ec
+        this._settings = St.Settings.get();
5731ec
+        this._settings.connect('notify::enable-animations',
5731ec
+            this._syncAnimationsEnabled.bind(this));
5731ec
+        this._syncAnimationsEnabled();
5731ec
     }
5731ec
 
5731ec
     _isStandaloneApp(app) {
5731ec
@@ -191,4 +199,21 @@ var IntrospectService = class {
5731ec
         }
5731ec
         invocation.return_value(new GLib.Variant('(a{ta{sv}})', [windowsList]));
5731ec
     }
5731ec
+
5731ec
+    _syncAnimationsEnabled() {
5731ec
+        let wasAnimationsEnabled = this._animationsEnabled;
5731ec
+        this._animationsEnabled = this._settings.enable_animations;
5731ec
+        if (wasAnimationsEnabled !== this._animationsEnabled) {
5731ec
+            let variant = new GLib.Variant('b', this._animationsEnabled);
5731ec
+            this._dbusImpl.emit_property_changed('AnimationsEnabled', variant);
5731ec
+        }
5731ec
+    }
5731ec
+
5731ec
+    get AnimationsEnabled() {
5731ec
+        return this._animationsEnabled;
5731ec
+    }
5731ec
+
5731ec
+    get version() {
5731ec
+        return INTROSPECT_DBUS_API_VERSION;
5731ec
+    }
5731ec
 };
5731ec
-- 
5731ec
2.26.2
5731ec