[gnome-shell] windowPreview: Track overlay state separately



commit bc6849c7a2a89371addc0e71a4b2229c748742a4
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Jan 8 18:36:55 2021 +0100

    windowPreview: Track overlay state separately
    
    We currently express the state as a combination of border visibility
    and the eventual transition state. That's tedious, in particular if
    we want to use the state outside the show()/hide() methods.
    
    Just track the requested visibility in a separate property.
    
    https://gitlab.gnome.org/Teams/Design/os-mockups/-/issues/81
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1605>

 js/ui/windowPreview.js | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
---
diff --git a/js/ui/windowPreview.js b/js/ui/windowPreview.js
index f6d1490a3d..014b2cc581 100644
--- a/js/ui/windowPreview.js
+++ b/js/ui/windowPreview.js
@@ -275,6 +275,7 @@ var WindowPreview = GObject.registerClass({
 
         this._selected = false;
         this._overlayEnabled = true;
+        this._overlayShown = false;
         this._closeRequested = false;
         this._idleHideOverlayId = 0;
 
@@ -457,14 +458,14 @@ var WindowPreview = GObject.registerClass({
         if (!this._overlayEnabled)
             return;
 
-        const ongoingTransition = this._border.get_transition('opacity');
-
-        // Don't do anything if we're fully visible already
-        if (this._border.visible && !ongoingTransition)
+        if (this._overlayShown)
             return;
 
+        this._overlayShown = true;
+
         // If we're supposed to animate and an animation in our direction
         // is already happening, let that one continue
+        const ongoingTransition = this._border.get_transition('opacity');
         if (animate &&
             ongoingTransition &&
             ongoingTransition.get_interval().peek_final_value() === 255)
@@ -488,14 +489,14 @@ var WindowPreview = GObject.registerClass({
     }
 
     hideOverlay(animate) {
-        const ongoingTransition = this._border.get_transition('opacity');
-
-        // Don't do anything if we're fully hidden already
-        if (!this._border.visible && !ongoingTransition)
+        if (!this._overlayShown)
             return;
 
+        this._overlayShown = false;
+
         // If we're supposed to animate and an animation in our direction
         // is already happening, let that one continue
+        const ongoingTransition = this._border.get_transition('opacity');
         if (animate &&
             ongoingTransition &&
             ongoingTransition.get_interval().peek_final_value() === 0)


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