[gnome-shell/eos3.8: 71/255] Adapt the grid's size when ViewsDisplayContainer changes its allocation



commit 41b27ab874fe45af2946a83a8d12be96e6971f14
Author: Mario Sanchez Prada <mario endlessm com>
Date:   Wed Jun 14 12:18:43 2017 +0100

    Adapt the grid's size when ViewsDisplayContainer changes its allocation
    
    In upstream's code, the AppDisplay's actor is the topmost container in
    the APPS page, controlled by ViewsSelector, so it made sense to connect
    to changes in the allocation of it to adapt its internal parameters used
    to compute the number of rows and dimensions of the internal actors, as
    such allocation would basically be the maximum available space in the
    screen to show the applications grid.
    
    However, in EOS we pack the AppDisplay's actor inside another container
    that will also hold the search entry widget and the search results page,
    meaning that the allocation of all those things (including the AppDisplay's
    actor that contains the grid) is now performed via a custom layout manager
    and so connecting to the allocation-changed signal at that level won't be
    right, since it will be triggered anytime we manually allocate AppDisplay,
    causing a chicken-egg situation since we need to allocate it to know the
    preferred height of it, and we need the preferred height of it to assign
    the right allocation considering the search box and the results page.
    
    The solution to this is to move the emission of the allocation-changed
    signal from the AppDisplay's top (container) actor to the new container
    that now owns AppDisplay, and which will now be added as the topmost
    actor in the APPs page of ViewsSelector. By doing this, we only get
    the allocation-changed signal emmitted when the allocation of the actual
    page changes (e.g. resolution change) and not each time we manually
    allocate the AppDisplay from the custom layout manager.
    
    https://phabricator.endlessm.com/T17230
    https://phabricator.endlessm.com/T17840

 js/ui/appDisplay.js   | 9 ---------
 js/ui/viewSelector.js | 9 +++++++++
 2 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 1b0fb4b0cf..2e4f32ccf4 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -430,15 +430,6 @@ class AppDisplay extends BaseAppView {
             });
     }
 
-    vfunc_allocate(box, flags) {
-        box = this.get_theme_node().get_content_box(box);
-        let availWidth = box.get_width();
-        let availHeight = box.get_height();
-        this.adaptToSize(availWidth, availHeight);
-
-        super.vfunc_allocate(box, flags);
-    }
-
     _onDestroy() {
         if (this._scrollTimeoutId !== 0) {
             GLib.source_remove(this._scrollTimeoutId);
diff --git a/js/ui/viewSelector.js b/js/ui/viewSelector.js
index 9c8c0676a8..3091849382 100644
--- a/js/ui/viewSelector.js
+++ b/js/ui/viewSelector.js
@@ -139,6 +139,15 @@ class ViewsDisplayLayout extends Clutter.BoxLayout {
     _onStyleChanged() {
         this.layout_changed();
     }
+
+    vfunc_allocate(actor, box, flags) {
+        let availWidth = box.x2 - box.x1;
+        let availHeight = box.y2 - box.y1;
+
+        this._appDisplayActor.adaptToSize(availWidth, availHeight);
+
+        super.vfunc_allocate(actor, box, flags);
+    }
 });
 
 var ViewsDisplayConstraint = GObject.registerClass(


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