windowManager: Always reset window actors when animations are cancelled

Remove all transformations from window actors after a window animation
was either cancelled or finished. Right now we only do that if the
transition finished successfully, which seems kind of pointless (it can
probably be historically explained because the callbacks inside the
"kill-window-effects" signal handler are connected to those
`*WindowDone()` functions though and the `*WindowOverwritten()`
functions were only added later in [1]).

This fixes a recent regression where a window animation would get
cancelled and remain stuck by switching workspaces. The regression
probably happened due to different behaviour of the `onOverwritten`
callback of Tweener and the `onStopped` callback of Clutter transitions:
For the workspace-switching animation the window actors get reparented
to a temporary container, which makes Clutter transititons emit
"stopped" (`clutter_actor_remove_child_internal()` stops transitions on
its children), while Tweener would continue the animation.

[1] 6dd302e5ce

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/784
This commit is contained in:
Jonas Dreßler 2019-10-26 09:40:40 +02:00 committed by Florian Müllner
parent c35b4cede5
commit b6d47c18c3

View File

@ -1359,12 +1359,7 @@ var WindowManager = class {
y: yDest, y: yDest,
duration: MINIMIZE_WINDOW_ANIMATION_TIME, duration: MINIMIZE_WINDOW_ANIMATION_TIME,
mode: Clutter.AnimationMode.EASE_IN_EXPO, mode: Clutter.AnimationMode.EASE_IN_EXPO,
onStopped: isFinished => { onStopped: () => this._minimizeWindowDone(shellwm, actor)
if (isFinished)
this._minimizeWindowDone(shellwm, actor);
else
this._minimizeWindowOverwritten(shellwm, actor);
}
}); });
} }
} }
@ -1380,12 +1375,6 @@ var WindowManager = class {
} }
} }
_minimizeWindowOverwritten(shellwm, actor) {
if (this._removeEffect(this._minimizing, actor)) {
shellwm.completed_minimize(actor);
}
}
_unminimizeWindow(shellwm, actor) { _unminimizeWindow(shellwm, actor) {
let types = [Meta.WindowType.NORMAL, let types = [Meta.WindowType.NORMAL,
Meta.WindowType.MODAL_DIALOG, Meta.WindowType.MODAL_DIALOG,
@ -1404,12 +1393,7 @@ var WindowManager = class {
opacity: 255, opacity: 255,
duration: MINIMIZE_WINDOW_ANIMATION_TIME, duration: MINIMIZE_WINDOW_ANIMATION_TIME,
mode: Clutter.AnimationMode.EASE_OUT_QUAD, mode: Clutter.AnimationMode.EASE_OUT_QUAD,
onStopped: isFinished => { onStopped: () => this._unminimizeWindowDone(shellwm, actor)
if (isFinished)
this._unminimizeWindowDone(shellwm, actor);
else
this._unminimizeWindowOverwritten(shellwm, actor);
}
}); });
} else { } else {
let [success, geom] = actor.meta_window.get_icon_geometry(); let [success, geom] = actor.meta_window.get_icon_geometry();
@ -1441,12 +1425,7 @@ var WindowManager = class {
y: yDest, y: yDest,
duration: MINIMIZE_WINDOW_ANIMATION_TIME, duration: MINIMIZE_WINDOW_ANIMATION_TIME,
mode: Clutter.AnimationMode.EASE_IN_EXPO, mode: Clutter.AnimationMode.EASE_IN_EXPO,
onStopped: isFinished => { onStopped: () => this._unminimizeWindowDone(shellwm, actor)
if (isFinished)
this._unminimizeWindowDone(shellwm, actor);
else
this._unminimizeWindowOverwritten(shellwm, actor);
}
}); });
} }
} }
@ -1462,12 +1441,6 @@ var WindowManager = class {
} }
} }
_unminimizeWindowOverwritten(shellwm, actor) {
if (this._removeEffect(this._unminimizing, actor)) {
shellwm.completed_unminimize(actor);
}
}
_sizeChangeWindow(shellwm, actor, whichChange, oldFrameRect, _oldBufferRect) { _sizeChangeWindow(shellwm, actor, whichChange, oldFrameRect, _oldBufferRect) {
let types = [Meta.WindowType.NORMAL]; let types = [Meta.WindowType.NORMAL];
if (!this._shouldAnimateActor(actor, types)) { if (!this._shouldAnimateActor(actor, types)) {
@ -1544,12 +1517,7 @@ var WindowManager = class {
translation_y: 0, translation_y: 0,
duration: WINDOW_ANIMATION_TIME, duration: WINDOW_ANIMATION_TIME,
mode: Clutter.AnimationMode.EASE_OUT_QUAD, mode: Clutter.AnimationMode.EASE_OUT_QUAD,
onStopped: isFinished => { onStopped: () => this._sizeChangeWindowDone(shellwm, actor)
if (isFinished)
this._sizeChangeWindowDone(shellwm, actor);
else
this._sizeChangeWindowOverwritten(shellwm, actor);
}
}); });
// Now unfreeze actor updates, to get it to the new size. // Now unfreeze actor updates, to get it to the new size.
@ -1579,11 +1547,6 @@ var WindowManager = class {
} }
} }
_sizeChangeWindowOverwritten(shellwm, actor) {
if (this._removeEffect(this._resizing, actor))
this._clearAnimationInfo(actor);
}
_hasAttachedDialogs(window, ignoreWindow) { _hasAttachedDialogs(window, ignoreWindow) {
var count = 0; var count = 0;
window.foreach_transient(win => { window.foreach_transient(win => {
@ -1681,12 +1644,7 @@ var WindowManager = class {
scale_y: 1, scale_y: 1,
duration: SHOW_WINDOW_ANIMATION_TIME, duration: SHOW_WINDOW_ANIMATION_TIME,
mode: Clutter.AnimationMode.EASE_OUT_EXPO, mode: Clutter.AnimationMode.EASE_OUT_EXPO,
onStopped: isFinished => { onStopped: () => this._mapWindowDone(shellwm, actor)
if (isFinished)
this._mapWindowDone(shellwm, actor);
else
this._mapWindowOverwrite(shellwm, actor);
}
}); });
break; break;
case Meta.WindowType.MODAL_DIALOG: case Meta.WindowType.MODAL_DIALOG:
@ -1703,12 +1661,7 @@ var WindowManager = class {
scale_y: 1, scale_y: 1,
duration: DIALOG_SHOW_WINDOW_ANIMATION_TIME, duration: DIALOG_SHOW_WINDOW_ANIMATION_TIME,
mode: Clutter.AnimationMode.EASE_OUT_QUAD, mode: Clutter.AnimationMode.EASE_OUT_QUAD,
onStopped: isFinished => { onStopped: () => this._mapWindowDone(shellwm, actor)
if (isFinished)
this._mapWindowDone(shellwm, actor);
else
this._mapWindowOverwrite(shellwm, actor);
}
}); });
break; break;
default: default:
@ -1729,12 +1682,6 @@ var WindowManager = class {
} }
} }
_mapWindowOverwrite(shellwm, actor) {
if (this._removeEffect(this._mapping, actor)) {
shellwm.completed_map(actor);
}
}
_destroyWindow(shellwm, actor) { _destroyWindow(shellwm, actor) {
let window = actor.meta_window; let window = actor.meta_window;
if (actor._notifyWindowTypeSignalId) { if (actor._notifyWindowTypeSignalId) {