From eb962887386654ca24ac479c40a35361c8916422 Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Sat, 10 Apr 2021 13:27:01 -0300 Subject: [PATCH] overviewControls: Use correct state when updating AppDisplay visibility When OverviewControls goes from HIDDEN to APP_GRID, it constantly checks if AppDisplay needs to be visible or not by checking the current overview state is bigger than WINDOW_PICKER. Turns out in this case this check is problematic, because when the current state trespasses WINDOW_PICKER, the layout manager will have already positioned AppDisplay halfway to its final position. Use either the final or the current state, whichever is biggest, when updating the AppDisplay visibility. It optionally allows passing the overview state params to _updateAppDisplayVisibility() so that we avoid a few trampolines to recaltulate the adjustment state. Part-of: --- js/ui/overviewControls.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/js/ui/overviewControls.js b/js/ui/overviewControls.js index a8974039d..10b97c7ac 100644 --- a/js/ui/overviewControls.js +++ b/js/ui/overviewControls.js @@ -518,9 +518,15 @@ class ControlsManager extends St.Widget { this._thumbnailsBox.ease(params); } - _updateAppDisplayVisibility() { + _updateAppDisplayVisibility(stateTransitionParams = null) { + if (!stateTransitionParams) + stateTransitionParams = this._stateAdjustment.getStateTransitionParams(); + + const { currentState, finalState } = stateTransitionParams; + const state = Math.max(currentState, finalState); + this._appDisplay.visible = - this._stateAdjustment.value > ControlsState.WINDOW_PICKER && + state > ControlsState.WINDOW_PICKER && !this._searchController.searchActive; } @@ -536,7 +542,7 @@ class ControlsManager extends St.Widget { fitModeAdjustment.value = fitMode; this._updateThumbnailsBox(); - this._updateAppDisplayVisibility(); + this._updateAppDisplayVisibility(params); } _onSearchChanged() {