From cad5e06041c307eb669f73a9d2377540f3105f71 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Thu, 6 Apr 2017 18:17:12 -0700 Subject: [PATCH] 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 file changed, 7 insertions(+), 1 deletion(-) diff --git a/js/ui/panelMenu.js b/js/ui/panelMenu.js index d427ab5ff..662287ef2 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() {