[gnome-shell/wip/overviewTransitions: 2/4] workspaceThumbnails: allow requesting size at any time



commit 4c8f1c78c4b9478766f4ef53282c49f96ce3366f
Author: Carlos Soriano <carlos soriano89 gmail com>
Date:   Thu Jul 31 17:35:27 2014 +0200

    workspaceThumbnails: allow requesting size at any time
    
    The slide of thumbnailWorkspace is shown when entering overview, connecting to
    the same signal that creates the thumbnails, the showing signal of overview,
    but, to make the slide animation we need to know how much width the slider has.
    To do that we ask the thumbnailsWorkspace about its width, but given that it
    connects to the same signal it could ask the width withouth having created the
    thumbnails yet, so reporting a width of 0 and confusing the slide animation.
    
    Currently it acccidentaly works because gjs calls the callbacks following the
    order of the clients connecting that signal, and accidentally the
    thumbnailsWorskpace is connected before the slide ones.
    
    To avoid that we allow to request the preferred size of the thumbnailsBox at any
    time with any number of thumbnails. The only thing required is to make sure the
    porthole is accesible when requesting the preferred size.

 js/ui/workspaceThumbnail.js |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/js/ui/workspaceThumbnail.js b/js/ui/workspaceThumbnail.js
index 14091a5..b285bf9 100644
--- a/js/ui/workspaceThumbnail.js
+++ b/js/ui/workspaceThumbnail.js
@@ -1121,9 +1121,7 @@ const ThumbnailsBox = new Lang.Class({
         // the size request to our children because we know how big they are and know
         // that the actors aren't depending on the virtual functions being called.
 
-        if (this._thumbnails.length == 0)
-            return;
-
+        this._ensurePorthole();
         let themeNode = this.actor.get_theme_node();
 
         let spacing = themeNode.get_length('spacing');
@@ -1135,8 +1133,7 @@ const ThumbnailsBox = new Lang.Class({
     },
 
     _getPreferredWidth: function(actor, forHeight, alloc) {
-        if (this._thumbnails.length == 0)
-            return;
+        this._ensurePorthole();
 
         let themeNode = this.actor.get_theme_node();
 
@@ -1154,6 +1151,10 @@ const ThumbnailsBox = new Lang.Class({
         alloc.natural_size = width;
     },
 
+    _ensurePorthole: function() {
+        this._porthole = Main.layoutManager.getWorkAreaForMonitor(Main.layoutManager.primaryIndex);
+    },
+
     _allocate: function(actor, box, flags) {
         let rtl = (Clutter.get_default_text_direction () == Clutter.TextDirection.RTL);
 


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