From bcd92857ae267bb561ee5e96591eeaaf606bd81d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Hedin=20Br=C3=B8nner?= Date: Thu, 28 Jan 2021 18:14:28 +0100 Subject: [PATCH] liveAltTab: try to fix fog that's stuck It's possible for the animation to stop before it's finished, making the `onComplete` event not trigger. Use `onStopped` instead as it's more robust. --- liveAltTab.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/liveAltTab.js b/liveAltTab.js index dc6dd38..e39ba17 100644 --- a/liveAltTab.js +++ b/liveAltTab.js @@ -148,16 +148,12 @@ class LiveAltTab extends AltTab.WindowSwitcherPopup { } _onDestroy() { - if(!this.was_accepted) { - // Select the starting window - this._select(0); - } super._onDestroy(); debug('#preview', 'onDestroy', this.was_accepted); Tweener.addTween(this.fog, { time: prefs.animation_time, opacity: 0, - onComplete: () => { + onStopped: () => { this.fog.destroy(); this.fog = null; // this.space.cloneContainer.remove_effect(this.blur); @@ -166,11 +162,14 @@ class LiveAltTab extends AltTab.WindowSwitcherPopup { this.space.moveDone(); } }); - let to = this._switcherList.windows[this._selectedIndex]; + let index = this.was_accepted ? this._selectedIndex : 0 + let to = this._switcherList.windows[index]; Tiling.focus_handler(to); - let actor = to.get_compositor_private(); - actor.x = this.clone.x; - actor.y = this.clone.y; + if (this.was_accepted) { + let actor = to.get_compositor_private(); + actor.x = this.clone.x; + actor.y = this.clone.y; + } actor.set_scale(1, 1); } });