[gnome-shell/eos3.8: 82/255] workspaceMonitor: Animate transition to desktop when minimizing the last window
- From: Matthew Leeds <mwleeds src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/eos3.8: 82/255] workspaceMonitor: Animate transition to desktop when minimizing the last window
- Date: Wed, 10 Jun 2020 19:04:51 +0000 (UTC)
commit 1761eb72ebb5fc155b04ce808dee69d8b6173b28
Author: Mario Sanchez Prada <mario endlessm com>
Date: Wed Jun 14 18:16:16 2017 +0100
workspaceMonitor: Animate transition to desktop when minimizing the last window
When minimizing the last window (or when closing the side component with no
windows open) we run a animation to transition from the desaturated state
of the icon grid to the solid one. Similarly, for consistency, we also run
the "opposite" animation when unmimizing the first window.
https://phabricator.endlessm.com/T17662
https://phabricator.endlessm.com/T19824
https://phabricator.endlessm.com/T20661
js/ui/layout.js | 29 +++++++++++++++++++++++++++++
js/ui/windowManager.js | 4 ++++
js/ui/workspaceMonitor.js | 19 +++++++++++++++++++
3 files changed, 52 insertions(+)
---
diff --git a/js/ui/layout.js b/js/ui/layout.js
index b37d854bec..d76d8921fc 100644
--- a/js/ui/layout.js
+++ b/js/ui/layout.js
@@ -4,6 +4,7 @@
const { Clutter, Gdk, Gio, GLib, GObject, Meta, Shell, St } = imports.gi;
const Signals = imports.signals;
+const AppDisplay = imports.ui.appDisplay;
const Background = imports.ui.background;
const BackgroundMenu = imports.ui.backgroundMenu;
const LoginManager = imports.misc.loginManager;
@@ -482,6 +483,34 @@ var LayoutManager = GObject.registerClass({
this._backgroundGroup.add_child(this._viewsClone);
}
+ _animateViewsClone(targetOpacity, targetSaturation) {
+ if (!this._viewsClone)
+ return;
+
+ this._viewsClone.show();
+
+ // Don't unnecessarily tween the clone's saturation & opacity.
+ if (this._viewsClone.opacity == targetOpacity && this._viewsClone.saturation == targetSaturation)
+ return;
+
+ this._viewsClone.ease({
+ opacity: targetOpacity,
+ saturation: targetSaturation,
+ duration: 250,
+ transition: AppDisplay.EOS_ACTIVE_GRID_TRANSITION,
+ });
+ }
+
+ prepareToEnterOverview() {
+ this._animateViewsClone(AppDisplay.EOS_ACTIVE_GRID_OPACITY,
+ AppDisplay.EOS_ACTIVE_GRID_SATURATION);
+ }
+
+ prepareToLeaveOverview() {
+ this._animateViewsClone(AppDisplay.EOS_INACTIVE_GRID_OPACITY,
+ AppDisplay.EOS_INACTIVE_GRID_SATURATION);
+ }
+
_addBackgroundMenu(bgManager) {
let clickAction = new Clutter.ClickAction();
bgManager.backgroundActor.add_action(clickAction);
diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js
index d1fe6f8f89..5646c3474c 100644
--- a/js/ui/windowManager.js
+++ b/js/ui/windowManager.js
@@ -839,6 +839,7 @@ var WindowManager = class {
// The desktop overlay needs to replicate the background's functionality;
// when clicked, we animate the side component out before emitting "background-clicked".
this._desktopOverlay.connect('clicked', () => {
+ Main.layoutManager.prepareToEnterOverview();
this._slideSideComponentOut(
this._shellwm,
this._desktopOverlay.overlayActor,
@@ -1512,6 +1513,7 @@ var WindowManager = class {
}
this._unminimizing.add(actor);
+ Main.layoutManager.prepareToLeaveOverview();
if (actor.meta_window.is_monitor_sized()) {
actor.opacity = 0;
@@ -1969,6 +1971,8 @@ var WindowManager = class {
if (!this._showDesktopOnDestroyDone && SideComponent.shouldHideOtherWindows(actor.meta_window)) {
// reveal other windows while we slide out the side component
this._showOtherWindows(actor, true);
+ } else if (this._showDesktopOnDestroyDone) {
+ Main.layoutManager.prepareToEnterOverview();
}
return;
diff --git a/js/ui/workspaceMonitor.js b/js/ui/workspaceMonitor.js
index fafe51de05..bac97ea925 100644
--- a/js/ui/workspaceMonitor.js
+++ b/js/ui/workspaceMonitor.js
@@ -9,7 +9,9 @@ const ViewSelector = imports.ui.viewSelector;
var WorkspaceMonitor = class {
constructor() {
this._shellwm = global.window_manager;
+ this._shellwm.connect('minimize', this._windowDisappearing.bind(this));
this._shellwm.connect('minimize-completed', this._windowDisappeared.bind(this));
+ this._shellwm.connect('destroy', this._windowDisappearing.bind(this));
this._shellwm.connect('destroy-completed', this._windowDisappeared.bind(this));
this._windowTracker = Shell.WindowTracker.get_default();
@@ -33,6 +35,23 @@ var WorkspaceMonitor = class {
}
}
+ _windowDisappearing(shellwm, actor) {
+ function _isLastWindow(apps, win) {
+ if (apps.length === 0)
+ return true;
+
+ if (apps.length > 1)
+ return false;
+
+ let windows = apps[0].get_windows();
+ return (windows.length === 1) && (windows[0] === win);
+ }
+
+ let visibleApps = this._getVisibleApps();
+ if (_isLastWindow(visibleApps, actor.meta_window))
+ Main.layoutManager.prepareToEnterOverview();
+ }
+
_updateOverview() {
let visibleApps = this._getVisibleApps();
if (visibleApps.length === 0) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]