From b6d47c18c360799a04954dc21fa40055779fe340 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= Date: Sat, 26 Oct 2019 09:40:40 +0200 Subject: [PATCH] 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] https://gitlab.gnome.org/GNOME/gnome-shell/commits/6dd302e5ce187d6db9266a7d6c0b94fd37fa46f4 https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/784 --- js/ui/windowManager.js | 65 ++++-------------------------------------- 1 file changed, 6 insertions(+), 59 deletions(-) diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js index 7ff30fdfc..0c4d8a493 100644 --- a/js/ui/windowManager.js +++ b/js/ui/windowManager.js @@ -1359,12 +1359,7 @@ var WindowManager = class { y: yDest, duration: MINIMIZE_WINDOW_ANIMATION_TIME, mode: Clutter.AnimationMode.EASE_IN_EXPO, - onStopped: isFinished => { - if (isFinished) - this._minimizeWindowDone(shellwm, actor); - else - this._minimizeWindowOverwritten(shellwm, actor); - } + onStopped: () => this._minimizeWindowDone(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) { let types = [Meta.WindowType.NORMAL, Meta.WindowType.MODAL_DIALOG, @@ -1404,12 +1393,7 @@ var WindowManager = class { opacity: 255, duration: MINIMIZE_WINDOW_ANIMATION_TIME, mode: Clutter.AnimationMode.EASE_OUT_QUAD, - onStopped: isFinished => { - if (isFinished) - this._unminimizeWindowDone(shellwm, actor); - else - this._unminimizeWindowOverwritten(shellwm, actor); - } + onStopped: () => this._unminimizeWindowDone(shellwm, actor) }); } else { let [success, geom] = actor.meta_window.get_icon_geometry(); @@ -1441,12 +1425,7 @@ var WindowManager = class { y: yDest, duration: MINIMIZE_WINDOW_ANIMATION_TIME, mode: Clutter.AnimationMode.EASE_IN_EXPO, - onStopped: isFinished => { - if (isFinished) - this._unminimizeWindowDone(shellwm, actor); - else - this._unminimizeWindowOverwritten(shellwm, actor); - } + onStopped: () => this._unminimizeWindowDone(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) { let types = [Meta.WindowType.NORMAL]; if (!this._shouldAnimateActor(actor, types)) { @@ -1544,12 +1517,7 @@ var WindowManager = class { translation_y: 0, duration: WINDOW_ANIMATION_TIME, mode: Clutter.AnimationMode.EASE_OUT_QUAD, - onStopped: isFinished => { - if (isFinished) - this._sizeChangeWindowDone(shellwm, actor); - else - this._sizeChangeWindowOverwritten(shellwm, actor); - } + onStopped: () => this._sizeChangeWindowDone(shellwm, actor) }); // 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) { var count = 0; window.foreach_transient(win => { @@ -1681,12 +1644,7 @@ var WindowManager = class { scale_y: 1, duration: SHOW_WINDOW_ANIMATION_TIME, mode: Clutter.AnimationMode.EASE_OUT_EXPO, - onStopped: isFinished => { - if (isFinished) - this._mapWindowDone(shellwm, actor); - else - this._mapWindowOverwrite(shellwm, actor); - } + onStopped: () => this._mapWindowDone(shellwm, actor) }); break; case Meta.WindowType.MODAL_DIALOG: @@ -1703,12 +1661,7 @@ var WindowManager = class { scale_y: 1, duration: DIALOG_SHOW_WINDOW_ANIMATION_TIME, mode: Clutter.AnimationMode.EASE_OUT_QUAD, - onStopped: isFinished => { - if (isFinished) - this._mapWindowDone(shellwm, actor); - else - this._mapWindowOverwrite(shellwm, actor); - } + onStopped: () => this._mapWindowDone(shellwm, actor) }); break; default: @@ -1729,12 +1682,6 @@ var WindowManager = class { } } - _mapWindowOverwrite(shellwm, actor) { - if (this._removeEffect(this._mapping, actor)) { - shellwm.completed_map(actor); - } - } - _destroyWindow(shellwm, actor) { let window = actor.meta_window; if (actor._notifyWindowTypeSignalId) {