[gnome-shell] osdWindow: scale by scaleFactor



commit 8492f2ba24911fb4553792f10395c3ef5d8ab69a
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Mon Feb 17 20:55:15 2014 -0800

    osdWindow: scale by scaleFactor
    
    Since we calculate this dimensions from the size of the monitor, the
    result was too large. Scale it by scaleFactor instead.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=724607

 js/ui/osdWindow.js |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/osdWindow.js b/js/ui/osdWindow.js
index 1d10f80..c9cb77d 100644
--- a/js/ui/osdWindow.js
+++ b/js/ui/osdWindow.js
@@ -200,8 +200,9 @@ const OsdWindow = new Lang.Class({
         let scale = Math.min(scalew, scaleh);
         this._popupSize = 110 * Math.max(1, scale);
 
+        let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
+        this._icon.icon_size = this._popupSize / (2 * scaleFactor);
         this._box.translation_y = monitor.height / 4;
-        this._icon.icon_size = this._popupSize / 2;
         this._box.style_changed();
     },
 
@@ -217,7 +218,10 @@ const OsdWindow = new Lang.Class({
         let minWidth = this._popupSize - verticalPadding - leftBorder - rightBorder;
         let minHeight = this._popupSize - horizontalPadding - topBorder - bottomBorder;
 
-        this._box.style = 'min-height: %dpx;'.format(Math.max(minWidth, minHeight));
+        // minWidth/minHeight here are in real pixels,
+        // but the theme takes measures in unscaled dimensions
+        let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
+        this._box.style = 'min-height: %dpx;'.format(Math.max(minWidth, minHeight) / scaleFactor);
     },
 
     setMonitor: function(index) {


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