panelMenu: Consider vertical margins when computing max-height

When opening a panel menu, we set it's max-height to the available
work-area height to keep menus with scrollable content from growing
outside the monitor. However a menu that extends all the way down
to the bottom edge does not look great either, so also take margins
into account here.

https://bugzilla.gnome.org/show_bug.cgi?id=744498
This commit is contained in:
Florian Müllner 2015-02-13 20:52:11 +01:00
parent 2f554e27f2
commit 7bb7734869
2 changed files with 3 additions and 1 deletions

View File

@ -715,6 +715,7 @@ StScrollBar StButton#vhandle:active {
.panel-menu { .panel-menu {
-boxpointer-gap: 4px; -boxpointer-gap: 4px;
margin-bottom: 1.75em;
} }
.panel-status-indicators-box, .panel-status-indicators-box,

View File

@ -173,7 +173,8 @@ const Button = new Lang.Class({
// menu is higher then the screen; it's useful if part of the menu is // menu is higher then the screen; it's useful if part of the menu is
// scrollable so the minimum height is smaller than the natural height // scrollable so the minimum height is smaller than the natural height
let workArea = Main.layoutManager.getWorkAreaForMonitor(Main.layoutManager.primaryIndex); let workArea = Main.layoutManager.getWorkAreaForMonitor(Main.layoutManager.primaryIndex);
this.menu.actor.style = ('max-height: ' + Math.round(workArea.height) + 'px;'); let verticalMargins = this.menu.actor.margin_top + this.menu.actor.margin_bottom;
this.menu.actor.style = ('max-height: ' + Math.round(workArea.height - verticalMargins) + 'px;');
}, },
destroy: function() { destroy: function() {