[gnome-shell/gnome-3-28] workspace: Avoid setting overlay title width



commit c04289853f17db78c47da8f9e2cd6360d32f4138
Author: verdre <gitlab v0yd nl>
Date:   Fri Jun 29 19:53:31 2018 +0200

    workspace: Avoid setting overlay title width
    
    Avoid setting the width of the overlay title ourselves to keep the
    default width of -1, this way StLabel will change its width by itself as
    soon as the text is updated.
    
    The width only needs to be changed if the window title changes, and we
    don't animate it in this case anyway so there's no need to pass a width
    to _animateOverlayActor().
    
    Setting the title width to the preferred width on relayout is impossible
    because get_preferred_width() will always return the width we set the
    label to before. If the width is not set to -1, there's no way to get
    the new preferred width without calculating it ourselves from the
    underlying ClutterText instance.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=787260

 js/ui/workspace.js | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/js/ui/workspace.js b/js/ui/workspace.js
index 1a230068e..d57e9acd8 100644
--- a/js/ui/workspace.js
+++ b/js/ui/workspace.js
@@ -545,12 +545,10 @@ var WindowOverlay = new Lang.Class({
         let titleX = cloneX + (cloneWidth - title.width) / 2;
         let titleY = cloneY + cloneHeight - (title.height - this.borderSize) / 2;
 
-        if (animate) {
-            this._animateOverlayActor(title, Math.floor(titleX), Math.floor(titleY), title.width);
-        } else {
-            title.width = title.width;
+        if (animate)
+            this._animateOverlayActor(title, Math.floor(titleX), Math.floor(titleY));
+        else
             title.set_position(Math.floor(titleX), Math.floor(titleY));
-        }
 
         let borderX = cloneX - this.borderSize;
         let borderY = cloneY - this.borderSize;
@@ -573,6 +571,9 @@ var WindowOverlay = new Lang.Class({
                        time: Overview.ANIMATION_TIME,
                        transition: 'easeOutQuad' };
 
+        if (width !== undefined)
+            params.width = width;
+
         if (height !== undefined)
             params.height = height;
 


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