diff --git a/data/theme/gnome-shell-high-contrast.css b/data/theme/gnome-shell-high-contrast.css index 1be7d6487..feb2b5008 100644 --- a/data/theme/gnome-shell-high-contrast.css +++ b/data/theme/gnome-shell-high-contrast.css @@ -823,8 +823,7 @@ StScrollBar { color: transparent; } .aggregate-menu { - min-width: 280px; - max-width: 400px; } + min-width: 280px; } .aggregate-menu .popup-menu-icon { padding: 0 4px; } diff --git a/data/theme/gnome-shell-sass b/data/theme/gnome-shell-sass index 01253d854..83b896b0e 160000 --- a/data/theme/gnome-shell-sass +++ b/data/theme/gnome-shell-sass @@ -1 +1 @@ -Subproject commit 01253d8545395de215c200cfe1be1b4667b9fa0b +Subproject commit 83b896b0e13725d7045ba3708265f6689952586c diff --git a/data/theme/gnome-shell.css b/data/theme/gnome-shell.css index db9af9bba..6ae2302f6 100644 --- a/data/theme/gnome-shell.css +++ b/data/theme/gnome-shell.css @@ -823,8 +823,7 @@ StScrollBar { color: transparent; } .aggregate-menu { - min-width: 280px; - max-width: 400px; } + min-width: 280px; } .aggregate-menu .popup-menu-icon { padding: 0 4px; } diff --git a/js/ui/panel.js b/js/ui/panel.js index 19336811f..3127db03f 100644 --- a/js/ui/panel.js +++ b/js/ui/panel.js @@ -652,6 +652,39 @@ const PanelCorner = new Lang.Class({ } }); +const AggregateLayout = new Lang.Class({ + Name: 'AggregateLayout', + Extends: Clutter.BoxLayout, + + _init: function(params) { + if (!params) + params = {}; + params['orientation'] = Clutter.Orientation.VERTICAL; + this.parent(params); + + this._sizeChildren = []; + }, + + addSizeChild: function(actor) { + this._sizeChildren.push(actor); + this.layout_changed(); + }, + + vfunc_get_preferred_width: function(container, forHeight) { + let themeNode = container.get_theme_node(); + let minWidth = themeNode.get_min_width(); + let natWidth = minWidth; + + for (let i = 0; i < this._sizeChildren.length; i++) { + let child = this._sizeChildren[i]; + let [childMin, childNat] = child.get_preferred_width(forHeight); + minWidth = Math.max(minWidth, childMin); + natWidth = Math.max(minWidth, childNat); + } + return [minWidth, natWidth]; + } +}); + const AggregateMenu = new Lang.Class({ Name: 'AggregateMenu', Extends: PanelMenu.Button, @@ -660,6 +693,9 @@ const AggregateMenu = new Lang.Class({ this.parent(0.0, C_("System menu in the top bar", "System"), false); this.menu.actor.add_style_class_name('aggregate-menu'); + let menuLayout = new AggregateLayout(); + this.menu.box.set_layout_manager(menuLayout); + this._indicators = new St.BoxLayout({ style_class: 'panel-status-indicators-box' }); this.actor.add_child(this._indicators); @@ -708,6 +744,11 @@ const AggregateMenu = new Lang.Class({ this.menu.addMenuItem(this._rfkill.menu); this.menu.addMenuItem(this._power.menu); this.menu.addMenuItem(this._system.menu); + + menuLayout.addSizeChild(this._location.menu.actor); + menuLayout.addSizeChild(this._rfkill.menu.actor); + menuLayout.addSizeChild(this._power.menu.actor); + menuLayout.addSizeChild(this._system.menu.actor); }, });