popupMenu: Don't always ignore SubMenu children in width requests

Hidden children are currently ignored in width requests; in the
case of submenu items, this results in abrupt width changes of
open menus when the corresponding SubMenuMenuItem is toggled.
To fix, only ignore SubMenu children when the corresponding
SubMenuMenuItem is hidden as well.

https://bugzilla.gnome.org/show_bug.cgi?id=683485
This commit is contained in:
Florian Müllner 2012-09-06 11:43:02 +02:00
parent 9d0eaa216f
commit 2ed28211ed

View File

@ -1100,7 +1100,8 @@ const PopupMenuBase = new Lang.Class({
let columnWidths = []; let columnWidths = [];
let items = this.box.get_children(); let items = this.box.get_children();
for (let i = 0; i < items.length; i++) { for (let i = 0; i < items.length; i++) {
if (!items[i].visible) if (!items[i].visible &&
!(items[i]._delegate instanceof PopupSubMenu && items[i-1].visible))
continue; continue;
if (items[i]._delegate instanceof PopupBaseMenuItem || items[i]._delegate instanceof PopupMenuBase) { if (items[i]._delegate instanceof PopupBaseMenuItem || items[i]._delegate instanceof PopupMenuBase) {
let itemColumnWidths = items[i]._delegate.getColumnWidths(); let itemColumnWidths = items[i]._delegate.getColumnWidths();