From a0cd05fbe3178a8be2aeb719523f5a83133811f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Dzi=C4=99giel?= Date: Thu, 25 Feb 2021 09:24:02 +0100 Subject: [PATCH] Workaround GTK4 revealers transition switch bug Changing transition in middle or when not fully revealed has dire consequences, seems to be a GTK4 bug. Workaround this bug by switching top revealer transition type only when fully revealed. --- src/revealers.js | 21 +++++++++++++++------ src/widget.js | 6 ++++-- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/revealers.js b/src/revealers.js index beadd5d5..fea10302 100644 --- a/src/revealers.js +++ b/src/revealers.js @@ -181,18 +181,27 @@ class ClapperRevealerTop extends CustomRevealer ? Gtk.RevealerTransitionType.SLIDE_DOWN : Gtk.RevealerTransitionType.CROSSFADE; - /* Changing transition in middle can have dire consequences, - * so change only when not in transition */ - if(this.reveal_child === this.child_revealed) + const isRevealed = this.child_revealed; + + /* FIXME: Changing transition in middle or when not fully + * revealed has dire consequences, seems to be a GTK4 bug */ + if(isRevealed && isRevealed === this.reveal_child) + this._checkSwitchTransitionType(); + } + + _checkSwitchTransitionType() + { + if(this.transition_type !== this._requestedTransition) this.transition_type = this._requestedTransition; } _onTopRevealed() { - if(this.transition_type !== this._requestedTransition) - this.transition_type = this._requestedTransition; - if(this.child_revealed) { + /* TODO: Move before above if statement when GTK4 can handle + * changing transition type while not fully revealed */ + this._checkSwitchTransitionType(); + const clapperWidget = this.root.child; if(!clapperWidget) return; diff --git a/src/widget.js b/src/widget.js index c762bf66..b3252e77 100644 --- a/src/widget.js +++ b/src/widget.js @@ -333,9 +333,11 @@ class ClapperWidget extends Gtk.Grid updateTime() { + const revealerTop = this.revealerTop; + if( - !this.revealerTop.visible - || !this.revealerTop.revealerGrid.visible + !revealerTop.visible + || !revealerTop.revealerGrid.visible ) return null;