From 499ae609dde8f0bfbce8c57172d9f58382114f8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 14 Mar 2013 19:08:46 +0100 Subject: [PATCH] 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 file changed, 25 insertions(+), 1 deletion(-) diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js index 79463b2ad..22ae481e5 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);