[gnome-shell] panelMenu: consider scale factor when setting max-height



commit cad5e06041c307eb669f73a9d2377540f3105f71
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Thu Apr 6 18:17:12 2017 -0700

    panelMenu: consider scale factor when setting max-height
    
    Since the workarea and margins are both in pysical pixels dimensions (we
    fetch margins from Clutter, not from the theme), but the CSS expects
    logical (scaled) pixels, unless we consider the scale factor when
    setting max-height, it won't work on a HiDpi display.
    
    This fixes missing scrollbars when the calendar popup is full on HiDpi
    displays.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=753305

 js/ui/panelMenu.js |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/js/ui/panelMenu.js b/js/ui/panelMenu.js
index d427ab5..662287e 100644
--- a/js/ui/panelMenu.js
+++ b/js/ui/panelMenu.js
@@ -174,8 +174,14 @@ 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);
+        let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
         let verticalMargins = this.menu.actor.margin_top + this.menu.actor.margin_bottom;
-        this.menu.actor.style = ('max-height: ' + Math.round(workArea.height - verticalMargins) + 'px;');
+
+        // The workarea and margin dimensions are in physical pixels, but CSS
+        // measures are in logical pixels, so make sure to consider the scale
+        // factor when computing max-height
+        let maxHeight = Math.round((workArea.height - verticalMargins) / scaleFactor);
+        this.menu.actor.style = ('max-height: %spx;').format(maxHeight);
     },
 
     destroy: function() {


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