From e70107c71416b5e6013ec3ac3ee06b32f4f04e0b Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Fri, 10 Feb 2023 21:20:01 -0500 Subject: [PATCH] Workaround wayland crash when switching unanimated ungrouped app #1664 --- appIcons.js | 22 +++++++++------------- utils.js | 2 +- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/appIcons.js b/appIcons.js index 6eef2a0..e7ebdea 100644 --- a/appIcons.js +++ b/appIcons.js @@ -750,24 +750,20 @@ var TaskbarAppIcon = GObject.registerClass({ // animation is enabled in settings // AND (going from a wide style to a narrow style indicator or vice-versa // OR going from an open app to a closed app or vice versa) - if(Me.settings.get_boolean('animate-app-switch') && - ((focusedIsWide != unfocusedIsWide) || - (this._focusedDots[sizeProp] != newUnfocusedDotsSize || this._unfocusedDots[sizeProp] != newFocusedDotsSize))) { - this._animateDotDisplay(this._focusedDots, newFocusedDotsSize, this._unfocusedDots, newUnfocusedDotsOpacity, sizeProp); - this._animateDotDisplay(this._unfocusedDots, newUnfocusedDotsSize, this._focusedDots, newFocusedDotsOpacity, sizeProp); - } else { - this._focusedDots.opacity = newFocusedDotsOpacity; - this._unfocusedDots.opacity = newUnfocusedDotsOpacity; - this._focusedDots[sizeProp] = newFocusedDotsSize; - this._unfocusedDots[sizeProp] = newUnfocusedDotsSize; - } + let animate = Me.settings.get_boolean('animate-app-switch') && + ((focusedIsWide != unfocusedIsWide) || + (this._focusedDots[sizeProp] != newUnfocusedDotsSize || this._unfocusedDots[sizeProp] != newFocusedDotsSize)) + let duration = animate ? Taskbar.DASH_ANIMATION_TIME : 0.001; + + this._animateDotDisplay(this._focusedDots, newFocusedDotsSize, this._unfocusedDots, newUnfocusedDotsOpacity, sizeProp, duration); + this._animateDotDisplay(this._unfocusedDots, newUnfocusedDotsSize, this._focusedDots, newFocusedDotsOpacity, sizeProp, duration); } } - _animateDotDisplay(dots, newSize, otherDots, newOtherOpacity, sizeProp) { + _animateDotDisplay(dots, newSize, otherDots, newOtherOpacity, sizeProp, duration) { if(dots[sizeProp] != newSize && dots._tweeningToSize !== newSize) { let tweenOpts = { - time: Taskbar.DASH_ANIMATION_TIME, + time: duration, transition: 'easeInOutCubic', onComplete: () => { if(newOtherOpacity > 0) diff --git a/utils.js b/utils.js index 284540e..fea9aa7 100644 --- a/utils.js +++ b/utils.js @@ -441,7 +441,7 @@ var animateWindowOpacity = function(window, tweenOpts) { var animate = function(actor, options) { //the original animations used Tweener instead of Clutter animations, so we //use "time" and "delay" properties defined in seconds, as opposed to Clutter - //animations duration" and "delay" which are defined in milliseconds + //animations "duration" and "delay" which are defined in milliseconds if (options.delay) { options.delay = options.delay * 1000; }