From: Daniel van Vugt <daniel.van.vugt@canonical.com>
Date: Thu, 17 Mar 2022 18:08:48 +0800
Subject: overview: Remove desktop fade logic

It existed to fade out/in `nautilus-desktop` for the overview, but it only
ever worked for X11 sessions (`Meta.WindowType.DESKTOP`) and
`nautilus-desktop` no longer exists anyway.

While I had suggested extending it in the past (!1395), that work was
never finished and since then the DING extension has implemented its
own visibility toggling. There seems little value in keeping the old
fade logic around in gnome-shell. Removing it actually fixes a bug with
DING (https://launchpad.net/bugs/1965072).

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2244>

Origin: https://gitlab.gnome.org/GNOME/gnome-shell/-/commit/2127222b
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/gnome-shell/+bug/1965072
---
 js/ui/overview.js         | 53 +----------------------------------------------
 js/ui/overviewControls.js |  4 ----
 2 files changed, 1 insertion(+), 56 deletions(-)

diff --git a/js/ui/overview.js b/js/ui/overview.js
index 73bef02..96ccde5 100644
--- a/js/ui/overview.js
+++ b/js/ui/overview.js
@@ -1,5 +1,5 @@
 // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
-/* exported Overview */
+/* exported Overview, ANIMATION_TIME */
 
 const { Clutter, Gio, GLib, GObject, Meta, Shell, St } = imports.gi;
 const Signals = imports.signals;
@@ -145,9 +145,6 @@ var Overview = class {
         if (this.isDummy)
             return;
 
-        this._desktopFade = new St.Widget();
-        Main.layoutManager.overviewGroup.add_child(this._desktopFade);
-
         this._activationTime = 0;
 
         this._visible = false;          // animating to overview, in overview, animating out
@@ -325,24 +322,6 @@ var Overview = class {
         return Clutter.EVENT_PROPAGATE;
     }
 
-    _getDesktopClone() {
-        let windows = global.get_window_actors().filter(
-            w => w.meta_window.get_window_type() === Meta.WindowType.DESKTOP);
-        if (windows.length == 0)
-            return null;
-
-        let window = windows[0];
-        const clone = new Clutter.Clone({
-            source: window,
-            x: window.x,
-            y: window.y,
-        });
-        clone.source.connect('destroy', () => {
-            clone.destroy();
-        });
-        return clone;
-    }
-
     _relayout() {
         // To avoid updating the position and size of the workspaces
         // we just hide the overview. The positions will be updated
@@ -442,34 +421,6 @@ var Overview = class {
         this._overview.searchEntry.grab_key_focus();
     }
 
-    fadeInDesktop() {
-        this._desktopFade.opacity = 0;
-        this._desktopFade.show();
-        this._desktopFade.ease({
-            opacity: 255,
-            mode: Clutter.AnimationMode.EASE_OUT_QUAD,
-            duration: ANIMATION_TIME,
-        });
-    }
-
-    fadeOutDesktop() {
-        if (!this._desktopFade.get_n_children()) {
-            let clone = this._getDesktopClone();
-            if (!clone)
-                return;
-
-            this._desktopFade.add_child(clone);
-        }
-
-        this._desktopFade.opacity = 255;
-        this._desktopFade.show();
-        this._desktopFade.ease({
-            opacity: 0,
-            mode: Clutter.AnimationMode.EASE_OUT_QUAD,
-            duration: ANIMATION_TIME,
-        });
-    }
-
     // Checks if the Activities button is currently sensitive to
     // clicks. The first call to this function within the
     // OVERVIEW_ACTIVATION_TIMEOUT time of the hot corner being
@@ -561,7 +512,6 @@ var Overview = class {
 
     _showDone() {
         this._animationInProgress = false;
-        this._desktopFade.hide();
         this._coverPane.hide();
 
         this.emit('shown');
@@ -617,7 +567,6 @@ var Overview = class {
         // Re-enable unredirection
         Meta.enable_unredirect_for_display(global.display);
 
-        this._desktopFade.hide();
         this._coverPane.hide();
 
         this._visible = false;
diff --git a/js/ui/overviewControls.js b/js/ui/overviewControls.js
index 1268697..4dd9a97 100644
--- a/js/ui/overviewControls.js
+++ b/js/ui/overviewControls.js
@@ -708,8 +708,6 @@ class ControlsManager extends St.Widget {
 
         this._searchController.prepareToEnterOverview();
         this._workspacesDisplay.prepareToEnterOverview();
-        if (!this._workspacesDisplay.activeWorkspaceHasMaximizedWindows())
-            Main.overview.fadeOutDesktop();
 
         this._stateAdjustment.value = ControlsState.HIDDEN;
         this._stateAdjustment.ease(state, {
@@ -731,8 +729,6 @@ class ControlsManager extends St.Widget {
         this._ignoreShowAppsButtonToggle = true;
 
         this._workspacesDisplay.prepareToLeaveOverview();
-        if (!this._workspacesDisplay.activeWorkspaceHasMaximizedWindows())
-            Main.overview.fadeInDesktop();
 
         this._stateAdjustment.ease(ControlsState.HIDDEN, {
             duration: Overview.ANIMATION_TIME,
