[gnome-shell/wip/exalm/gestures2: 102/110] workspaceAnimation: Stop depending on shellwm
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/exalm/gestures2: 102/110] workspaceAnimation: Stop depending on shellwm
- Date: Fri, 29 Jan 2021 17:02:41 +0000 (UTC)
commit 51bc3b24db036a7182eae5ec773221b5dc19a198
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date: Tue Jan 21 18:09:56 2020 +0500
workspaceAnimation: Stop depending on shellwm
js/ui/windowManager.js | 20 +++++++++++++++++++-
js/ui/workspaceAnimation.js | 32 +++++++++++++++-----------------
2 files changed, 34 insertions(+), 18 deletions(-)
---
diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js
index 34c731428f..2d2d2e32f1 100644
--- a/js/ui/windowManager.js
+++ b/js/ui/windowManager.js
@@ -960,6 +960,11 @@ var WindowManager = class {
this._workspaceAnimation =
new WorkspaceAnimation.WorkspaceAnimationController();
+
+ this._shellwm.connect('kill-switch-workspace', () => {
+ this._workspaceAnimation.cancelSwitchAnimation();
+ this._switchWorkspaceDone();
+ });
}
async _startX11Services(task, cancellable) {
@@ -1618,7 +1623,20 @@ var WindowManager = class {
return;
}
- this._workspaceAnimation.animateSwitch(shellwm, from, to, direction);
+ this._switchInProgress = true;
+
+ this._workspaceAnimation.animateSwitch(from, to, direction, () => {
+ this._shellwm.completed_switch_workspace();
+ this._switchInProgress = false;
+ });
+ }
+
+ _switchWorkspaceDone() {
+ if (!this._switchInProgress)
+ return;
+
+ this._shellwm.completed_switch_workspace();
+ this._switchInProgress = false;
}
_showTilePreview(shellwm, window, tileRect, monitorIndex) {
diff --git a/js/ui/workspaceAnimation.js b/js/ui/workspaceAnimation.js
index 9d7a98905d..17002667e0 100644
--- a/js/ui/workspaceAnimation.js
+++ b/js/ui/workspaceAnimation.js
@@ -10,18 +10,8 @@ const WINDOW_ANIMATION_TIME = 250;
var WorkspaceAnimationController = class {
constructor() {
- this._shellwm = global.window_manager;
this._movingWindow = null;
-
this._switchData = null;
- this._shellwm.connect('kill-switch-workspace', shellwm => {
- if (this._switchData) {
- if (this._switchData.inProgress)
- this._switchWorkspaceDone(shellwm);
- else if (!this._switchData.gestureActivated)
- this._finishWorkspaceSwitch(this._switchData);
- }
- });
global.display.connect('restacked', this._syncStacking.bind(this));
@@ -225,7 +215,7 @@ var WorkspaceAnimationController = class {
this.movingWindow = null;
}
- animateSwitch(shellwm, from, to, direction) {
+ animateSwitch(from, to, direction, onComplete) {
this._prepareWorkspaceSwitch(from, to, direction);
this._switchData.inProgress = true;
@@ -247,15 +237,13 @@ var WorkspaceAnimationController = class {
y: yDest,
duration: WINDOW_ANIMATION_TIME,
mode: Clutter.AnimationMode.EASE_OUT_CUBIC,
- onComplete: () => this._switchWorkspaceDone(shellwm),
+ onComplete: () => {
+ this._finishWorkspaceSwitch(this._switchData);
+ onComplete();
+ },
});
}
- _switchWorkspaceDone(shellwm) {
- this._finishWorkspaceSwitch(this._switchData);
- shellwm.completed_switch_workspace();
- }
-
_directionForProgress(progress) {
if (global.workspace_manager.layout_rows === -1) {
return progress > 0
@@ -412,6 +400,16 @@ var WorkspaceAnimationController = class {
return this._switchData !== null && this._switchData.gestureActivated;
}
+ cancelSwitchAnimation() {
+ if (!this._switchData)
+ return;
+
+ if (this._switchData.gestureActivated)
+ return;
+
+ this._finishWorkspaceSwitch(this._switchData);
+ }
+
set movingWindow(movingWindow) {
this._movingWindow = movingWindow;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]