[gnome-shell] search: Defer updating results on allocation changes until redraw



commit 21966afbc6992fa825217666c2f7de55e1d61be5
Author: Jonas Dreßler <verdre v0yd nl>
Date:   Wed Aug 7 17:39:25 2019 +0200

    search: Defer updating results on allocation changes until redraw
    
    Since the `notify::allocation` signal will obviously get emitted while
    the actor is inside an allocation cycle and we might end up doing
    changes to its allocation inside `updateSearch` by hiding or showing the
    actor (which queues a relayout), we get a warning from Clutter.
    
    Fix this by delaying the call to the parent method until the next
    redraw, which should happen a few moments after the current relayout.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/672

 js/ui/search.js | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/search.js b/js/ui/search.js
index 7a7a5071fc..d55021ac91 100644
--- a/js/ui/search.js
+++ b/js/ui/search.js
@@ -1,6 +1,6 @@
 // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
 
-const { Clutter, Gio, GLib, GObject, Shell, St } = imports.gi;
+const { Clutter, Gio, GLib, GObject, Meta, Shell, St } = imports.gi;
 const Signals = imports.signals;
 
 const AppDisplay = imports.ui.appDisplay;
@@ -348,7 +348,10 @@ var GridSearchResults = class extends SearchResultsBase {
         // Make sure the maximum number of results calculated by
         // _getMaxDisplayedResults() is updated after width changes.
         this._notifyAllocationId = this.actor.connect('notify::allocation', () => {
-            super.updateSearch(...args);
+            Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
+                super.updateSearch(...args);
+                return GLib.SOURCE_REMOVE;
+            });
         });
 
         super.updateSearch(...args);


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