[gnome-shell/wip/fmuellner/notification-redux: 1/82] panelMenu: Consider vertical margins when computing max-height



commit e4333399d9369b253616959f08e8b206c9027123
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Feb 13 20:52:11 2015 +0100

    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.

 data/theme/gnome-shell.css |    1 +
 js/ui/panelMenu.js         |    3 ++-
 2 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/data/theme/gnome-shell.css b/data/theme/gnome-shell.css
index dc9a006..2f41fe5 100644
--- a/data/theme/gnome-shell.css
+++ b/data/theme/gnome-shell.css
@@ -170,6 +170,7 @@ StScrollBar StButton#vhandle:active {
 
 .popup-menu {
     min-width: 200px;
+    margin-bottom: 1.75em;
 }
 
 .popup-menu-arrow {
diff --git a/js/ui/panelMenu.js b/js/ui/panelMenu.js
index 29acd29..092ca23 100644
--- a/js/ui/panelMenu.js
+++ b/js/ui/panelMenu.js
@@ -173,7 +173,8 @@ const Button = new Lang.Class({
         // 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
         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() {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]