workspaceAnimation: Stop depending on shellwm
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/605
This commit is contained in:
parent
fa31bcaa7a
commit
6d5446e4a6
@ -945,6 +945,14 @@ var WindowManager = class {
|
|||||||
|
|
||||||
this._workspaceAnimation =
|
this._workspaceAnimation =
|
||||||
new WorkspaceAnimation.WorkspaceAnimationController();
|
new WorkspaceAnimation.WorkspaceAnimationController();
|
||||||
|
|
||||||
|
this._shellwm.connect('kill-switch-workspace', () => {
|
||||||
|
if (!this._workspaceAnimation.isAnimating() || this._workspaceAnimation.canCancelGesture())
|
||||||
|
return;
|
||||||
|
|
||||||
|
this._workspaceAnimation.cancelSwitchAnimation();
|
||||||
|
this._shellwm.completed_switch_workspace();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
_showPadOsd(display, device, settings, imagePath, editionMode, monitorIndex) {
|
_showPadOsd(display, device, settings, imagePath, editionMode, monitorIndex) {
|
||||||
@ -1554,8 +1562,9 @@ var WindowManager = class {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._workspaceAnimation.animateSwitchWorkspace(shellwm, from, to,
|
this._workspaceAnimation.animateSwitchWorkspace(from, to, direction, () => {
|
||||||
direction);
|
this._shellwm.completed_switch_workspace();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
_showTilePreview(shellwm, window, tileRect, monitorIndex) {
|
_showTilePreview(shellwm, window, tileRect, monitorIndex) {
|
||||||
|
@ -10,18 +10,8 @@ const WINDOW_ANIMATION_TIME = 250;
|
|||||||
|
|
||||||
var WorkspaceAnimationController = class {
|
var WorkspaceAnimationController = class {
|
||||||
constructor() {
|
constructor() {
|
||||||
this._shellwm = global.window_manager;
|
|
||||||
this._movingWindow = null;
|
this._movingWindow = null;
|
||||||
|
|
||||||
this._switchData = 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));
|
global.display.connect('restacked', this._syncStacking.bind(this));
|
||||||
|
|
||||||
@ -231,7 +221,7 @@ var WorkspaceAnimationController = class {
|
|||||||
this.movingWindow = null;
|
this.movingWindow = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
animateSwitchWorkspace(shellwm, from, to, direction) {
|
animateSwitchWorkspace(from, to, direction, onComplete) {
|
||||||
this._prepareWorkspaceSwitch(from, to, direction);
|
this._prepareWorkspaceSwitch(from, to, direction);
|
||||||
this._switchData.inProgress = true;
|
this._switchData.inProgress = true;
|
||||||
|
|
||||||
@ -253,15 +243,13 @@ var WorkspaceAnimationController = class {
|
|||||||
y: yDest,
|
y: yDest,
|
||||||
duration: WINDOW_ANIMATION_TIME,
|
duration: WINDOW_ANIMATION_TIME,
|
||||||
mode: Clutter.AnimationMode.EASE_OUT_CUBIC,
|
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) {
|
_directionForProgress(progress) {
|
||||||
if (global.workspace_manager.layout_rows === -1) {
|
if (global.workspace_manager.layout_rows === -1) {
|
||||||
return progress > 0
|
return progress > 0
|
||||||
@ -418,6 +406,10 @@ var WorkspaceAnimationController = class {
|
|||||||
return this._switchData !== null;
|
return this._switchData !== null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
canCancelGesture() {
|
||||||
|
return this.isAnimating() && this._switchData.gestureActivated;
|
||||||
|
}
|
||||||
|
|
||||||
set movingWindow(movingWindow) {
|
set movingWindow(movingWindow) {
|
||||||
this._movingWindow = movingWindow;
|
this._movingWindow = movingWindow;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user