popupMenu: fix relayout after submenu open/close

Because of the GtkSizeGroup-like trickiness we're doing with
PopupMenuItems, we need to force Clutter to discard its cached size
requests for them any time the menu itself changes size.

https://bugzilla.gnome.org/show_bug.cgi?id=645647
This commit is contained in:
Dan Winship 2011-03-25 10:14:55 -04:00
parent 475161f716
commit 924b31233b

View File

@ -765,6 +765,7 @@ PopupMenuBase.prototype = {
} else { } else {
this.box = new St.BoxLayout({ vertical: true }); this.box = new St.BoxLayout({ vertical: true });
} }
this.box.connect_after('queue-relayout', Lang.bind(this, this._menuQueueRelayout));
this.isOpen = false; this.isOpen = false;
@ -893,6 +894,16 @@ PopupMenuBase.prototype = {
} }
}, },
// Because of the above column-width funniness, we need to do a
// queue-relayout on every item whenever the menu itself changes
// size, to force clutter to drop its cached size requests. (The
// menuitems will in turn call queue_relayout on their parent, the
// menu, but that call will be a no-op since the menu already
// has a relayout queued, so we won't get stuck in a loop.
_menuQueueRelayout: function() {
this.box.get_children().map(function (actor) { actor.queue_relayout(); });
},
addActor: function(actor) { addActor: function(actor) {
this.box.add(actor); this.box.add(actor);
}, },