[gnome-shell/wip/fmuellner/overview-tweaks: 6/7] workspace: Don't restrict title width to window preview



commit 3094aa22500dd5720cb0a23c5478ab16663596f3
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Jun 1 16:36:10 2017 +0200

    workspace: Don't restrict title width to window preview
    
    Now that only one window title is visible at any time, it no longer
    matters if a title extends into other window previews, so we can
    always show the full title.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=783953

 js/ui/workspace.js |   23 ++++++-----------------
 1 files changed, 6 insertions(+), 17 deletions(-)
---
diff --git a/js/ui/workspace.js b/js/ui/workspace.js
index 7552357..705a732 100644
--- a/js/ui/workspace.js
+++ b/js/ui/workspace.js
@@ -475,8 +475,8 @@ const WindowOverlay = new Lang.Class({
         Shell.util_set_hidden_from_pick(this.title, true);
         Shell.util_set_hidden_from_pick(this.border, true);
 
-        parentActor.add_actor(this.title);
         parentActor.add_actor(this.border);
+        parentActor.add_actor(this.title);
         parentActor.add_actor(this.closeButton);
         title.connect('style-changed',
                       Lang.bind(this, this._onStyleChanged));
@@ -539,24 +539,13 @@ const WindowOverlay = new Lang.Class({
         else
             button.set_position(Math.floor(buttonX), Math.floor(buttonY));
 
-        // Clutter.Actor.get_preferred_width() will return the fixed width if one
-        // is set, so we need to reset the width by calling set_width(-1), to forward
-        // the call down to StLabel.
-        // We also need to save and restore the current width, otherwise the animation
-        // starts from the wrong point.
-        let prevTitleWidth = title.width;
-        title.set_width(-1);
-        let [titleMinWidth, titleNatWidth] = title.get_preferred_width(-1);
-        let titleWidth = Math.max(titleMinWidth, Math.min(titleNatWidth, cloneWidth));
-        title.width = prevTitleWidth;
-
-        let titleX = cloneX + (cloneWidth - titleWidth) / 2;
+        let titleX = cloneX + (cloneWidth - title.width) / 2;
         let titleY = cloneY + (cloneHeight - title.height) / 2;
 
-        if (animate)
-            this._animateOverlayActor(title, Math.floor(titleX), Math.floor(titleY), titleWidth);
-        else {
-            title.width = titleWidth;
+        if (animate) {
+            this._animateOverlayActor(title, Math.floor(titleX), Math.floor(titleY), title.width);
+        } else {
+            title.width = title.width;
             title.set_position(Math.floor(titleX), Math.floor(titleY));
         }
 


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