[gnome-shell] overviewControls: Use correct state when updating AppDisplay visibility



commit eb962887386654ca24ac479c40a35361c8916422
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Sat Apr 10 13:27:01 2021 -0300

    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: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1805>

 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 a8974039d2..10b97c7ac0 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() {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]