[gnome-shell] iconGrid: Don't hide children inside allocation loop



commit 520cea93941bfef1ec7bcaf30427d6a7b4036eb3
Author: Marco Trevisan (Treviño) <mail 3v1n0 net>
Date:   Thu Jun 6 23:21:13 2019 +0200

    iconGrid: Don't hide children inside allocation loop
    
    Hiding a child implies a parent reallocation, and IconGrid does it for the
    children that doesn't fit in the available space, but this could lead to an
    allocation recursion cycle. This has been introduced by commit 0e0574a0 to
    reduce CPU usage not to using JS vfuncs.
    
    To avoid this, toggle the children opacity instead so that we can achieve the
    same visibility result, without any reallocation need.
    In this way we also fix the case where hidden children can be shown again,
    as _getVisibleChildren doesn't filter-out transparent ones, restoring the
    pre-commit 0e0574a0 behavior.
    
    Fixes https://gitlab.gnome.org/GNOME/gnome-shell/issues/1336
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/559

 js/ui/iconGrid.js | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/js/ui/iconGrid.js b/js/ui/iconGrid.js
index 4d32e8bcf..d428897a9 100644
--- a/js/ui/iconGrid.js
+++ b/js/ui/iconGrid.js
@@ -331,10 +331,10 @@ var IconGrid = GObject.registerClass({
 
             if (this._rowLimit && rowIndex >= this._rowLimit ||
                 this._fillParent && childBox.y2 > availHeight - this.bottomPadding) {
-                children[i].hide();
+                children[i].opacity = 0;
             } else {
+                children[i].opacity = 255;
                 children[i].allocate(childBox, flags);
-                children[i].show();
             }
 
             columnIndex++;
@@ -378,7 +378,7 @@ var IconGrid = GObject.registerClass({
              child != null;
              child = child.get_next_sibling()) {
 
-            if (!child.visible)
+            if (!child.visible || !child.opacity)
                 continue;
 
             let childVolume = child.get_transformed_paint_volume(this);


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