[gnome-shell/wip/fmuellner/calendar-refresh: 2/15] dateMenu: Do a better job at size freezing while browsing dates



commit 4b166dcc79fe293cc6554a366e3c7d80e1884f63
Author: Florian Müllner <fmuellner gnome org>
Date:   Sun Feb 26 14:37:51 2017 +0100

    dateMenu: Do a better job at size freezing while browsing dates
    
    In order to avoid distracting popup size changes while browsing
    other dates, we freeze the size to the last size request. However
    in case of more complex size negotiations - wrapping or ellipsizing
    labels, scrollable elements etc. - there's a chance of stray calls
    to get_preferred_width/height() that are not used for the actual
    allocation. If such a call happens to be the last size request
    before the layout is frozen, the saved size will be wrong. To fix
    this, save the allocated size rather than the requested one.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=754031

 js/ui/dateMenu.js |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/dateMenu.js b/js/ui/dateMenu.js
index 47b22a4..9e49e2d 100644
--- a/js/ui/dateMenu.js
+++ b/js/ui/dateMenu.js
@@ -279,14 +279,22 @@ const FreezableBinLayout = new Lang.Class({
 
     vfunc_get_preferred_width: function(container, forHeight) {
         if (!this._frozen || this._savedWidth.some(isNaN))
-            this._savedWidth = this.parent(container, forHeight);
+            return this.parent(container, forHeight);
         return this._savedWidth;
     },
 
     vfunc_get_preferred_height: function(container, forWidth) {
         if (!this._frozen || this._savedHeight.some(isNaN))
-            this._savedHeight = this.parent(container, forWidth);
+            return this.parent(container, forWidth);
         return this._savedHeight;
+    },
+
+    vfunc_allocate: function(container, allocation, flags) {
+        this.parent(container, allocation, flags);
+
+        let [width, height] = allocation.get_size();
+        this._savedWidth = [width, width];
+        this._savedHeight = [height, height];
     }
 });
 


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