From 4b166dcc79fe293cc6554a366e3c7d80e1884f63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Sun, 26 Feb 2017 14:37:51 +0100 Subject: [PATCH] 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 file changed, 10 insertions(+), 2 deletions(-) diff --git a/js/ui/dateMenu.js b/js/ui/dateMenu.js index 47b22a495..9e49e2d9a 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]; } });