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.
This commit is contained in:
Rafał Dzięgiel
2021-02-25 09:24:02 +01:00
parent d2d43db2c9
commit a0cd05fbe3
2 changed files with 19 additions and 8 deletions

View File

@@ -181,18 +181,27 @@ class ClapperRevealerTop extends CustomRevealer
? Gtk.RevealerTransitionType.SLIDE_DOWN ? Gtk.RevealerTransitionType.SLIDE_DOWN
: Gtk.RevealerTransitionType.CROSSFADE; : Gtk.RevealerTransitionType.CROSSFADE;
/* Changing transition in middle can have dire consequences, const isRevealed = this.child_revealed;
* so change only when not in transition */
if(this.reveal_child === 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; this.transition_type = this._requestedTransition;
} }
_onTopRevealed() _onTopRevealed()
{ {
if(this.transition_type !== this._requestedTransition)
this.transition_type = this._requestedTransition;
if(this.child_revealed) { 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; const clapperWidget = this.root.child;
if(!clapperWidget) return; if(!clapperWidget) return;

View File

@@ -333,9 +333,11 @@ class ClapperWidget extends Gtk.Grid
updateTime() updateTime()
{ {
const revealerTop = this.revealerTop;
if( if(
!this.revealerTop.visible !revealerTop.visible
|| !this.revealerTop.revealerGrid.visible || !revealerTop.revealerGrid.visible
) )
return null; return null;