[gnome-shell] appDisplay: Use a custom LayoutManager for the AllView stack



commit 499ae609dde8f0bfbce8c57172d9f58382114f8c
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Mar 14 19:08:46 2013 +0100

    appDisplay: Use a custom LayoutManager for the AllView stack
    
    ClutterBinLayout uses the maximum width/height of all children in
    size requests and positions children according to the expand/align
    properties. This means that the vertical position of folder popups
    is not considered in size requests, so if the main view is smaller
    than a folder popup's height and offset, the popup will be truncated
    and/or mispositioned. Fix those cases by using a custom LayoutManager
    that behaves like ClutterFixedLayout for height requests and like
    ClutterBinLayout otherwise.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=694371

 js/ui/appDisplay.js |   26 +++++++++++++++++++++++++-
 1 files changed, 25 insertions(+), 1 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 79463b2..22ae481 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -156,6 +156,30 @@ const FolderView = new Lang.Class({
     }
 });
 
+const AllViewLayout = new Lang.Class({
+    Name: 'AllViewLayout',
+    Extends: Clutter.BinLayout,
+
+    vfunc_get_preferred_height: function(container, forWidth) {
+        let minBottom = 0;
+        let naturalBottom = 0;
+
+        for (let child = container.get_first_child();
+             child;
+             child = child.get_next_sibling()) {
+            let childY = child.y;
+            let [childMin, childNatural] = child.get_preferred_height(forWidth);
+
+            if (childMin + childY > minBottom)
+                minBottom = childMin + childY;
+
+            if (childNatural + childY > naturalBottom)
+                naturalBottom = childNatural + childY;
+        }
+        return [minBottom, naturalBottom];
+    }
+});
+
 const AllView = new Lang.Class({
     Name: 'AllView',
     Extends: AlphabeticalView,
@@ -164,7 +188,7 @@ const AllView = new Lang.Class({
         this.parent();
 
         let box = new St.BoxLayout({ vertical: true });
-        this._stack = new St.Widget({ layout_manager: new Clutter.BinLayout() });
+        this._stack = new St.Widget({ layout_manager: new AllViewLayout() });
         this._stack.add_actor(this._grid.actor);
         this._eventBlocker = new St.Widget({ x_expand: true, y_expand: true });
         this._stack.add_actor(this._eventBlocker);


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