[gnome-shell] appDisplay: Don't grow indicators more than the parent



commit 84cbbafaaeea987033ade89dcf5b2e7e5593a2c5
Author: Carlos Soriano <carlos soriano89 gmail com>
Date:   Tue Aug 5 11:17:32 2014 +0200

    appDisplay: Don't grow indicators more than the parent
    
    Currently the indicators are a BoxLayout inside a BinLayout in AllView.
    BinLayout doesn't have any size constraint, so if the indicators request
    a bigger size than AllView the entire overview is grown, causing the
    overview to go crazy.
    
    To avoid that, create an actor for the page indicators that request as
    minimum size 0, and as a natural size, the sum of all indicators natural
    sizes. Then we clip_to_allocation, so it doesn't grow more than the
    parent.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=723496

 js/ui/appDisplay.js |   30 ++++++++++++++++++++++++------
 1 files changed, 24 insertions(+), 6 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 253d4c4..194905f 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -181,17 +181,35 @@ const BaseAppView = new Lang.Class({
 });
 Signals.addSignalMethods(BaseAppView.prototype);
 
+const PageIndicatorsActor = new Lang.Class({
+    Name:'PageIndicatorsActor',
+    Extends: St.BoxLayout,
+
+    _init: function() {
+        this.parent({ style_class: 'page-indicators',
+                      vertical: true,
+                      x_expand: true, y_expand: true,
+                      x_align: Clutter.ActorAlign.END,
+                      y_align: Clutter.ActorAlign.CENTER,
+                      reactive: true,
+                      clip_to_allocation: true });
+    },
+
+    vfunc_get_preferred_height: function(forWidth) {
+        // We want to request the natural height of all our children as our
+        // natural height, so we chain up to St.BoxLayout, but we only request 0
+        // as minimum height, since it's not that important if some indicators
+        // are not shown
+        let [, natHeight] = this.parent(forWidth);
+        return [0, natHeight];
+    }
+});
 
 const PageIndicators = new Lang.Class({
     Name:'PageIndicators',
 
     _init: function() {
-        this.actor = new St.BoxLayout({ style_class: 'page-indicators',
-                                        vertical: true,
-                                        x_expand: true, y_expand: true,
-                                        x_align: Clutter.ActorAlign.END,
-                                        y_align: Clutter.ActorAlign.CENTER,
-                                        reactive: true });
+        this.actor = new PageIndicatorsActor();
         this._nPages = 0;
         this._currentPage = undefined;
 


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