[gnome-shell] dash: account for scale factor to determine icon size



commit e92d204d4251eb1396bf6658314d86388dad55ca
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Sat Feb 15 21:35:13 2014 -0800

    dash: account for scale factor to determine icon size
    
    https://bugzilla.gnome.org/show_bug.cgi?id=705410

 js/ui/dash.js |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/js/ui/dash.js b/js/ui/dash.js
index dfe8710..0d5db8e 100644
--- a/js/ui/dash.js
+++ b/js/ui/dash.js
@@ -381,6 +381,8 @@ const DashActor = new Lang.Class({
     }
 });
 
+const baseIconSizes = [ 16, 22, 24, 32, 48, 64 ];
+
 const Dash = new Lang.Class({
     Name: 'Dash',
 
@@ -632,25 +634,24 @@ const Dash = new Lang.Class({
         let minHeight, natHeight;
 
         // Enforce the current icon size during the size request
-        let [currentWidth, currentHeight] = firstIcon.icon.get_size();
-
-        firstIcon.icon.set_size(this.iconSize, this.iconSize);
+        firstIcon.setIconSize(this.iconSize);
         [minHeight, natHeight] = firstButton.get_preferred_height(-1);
 
-        firstIcon.icon.set_size(currentWidth, currentHeight);
+        let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
+        let iconSizes = baseIconSizes.map(function(s) {
+            return s * scaleFactor;
+        });
 
         // Subtract icon padding and box spacing from the available height
-        availHeight -= iconChildren.length * (natHeight - this.iconSize) +
+        availHeight -= iconChildren.length * (natHeight - this.iconSize * scaleFactor) +
                        (iconChildren.length - 1) * spacing;
 
         let availSize = availHeight / iconChildren.length;
 
-        let iconSizes = [ 16, 22, 24, 32, 48, 64 ];
-
-        let newIconSize = 16;
+        let newIconSize = baseIconSizes[0];
         for (let i = 0; i < iconSizes.length; i++) {
             if (iconSizes[i] < availSize)
-                newIconSize = iconSizes[i];
+                newIconSize = baseIconSizes[i];
         }
 
         if (newIconSize == this.iconSize)


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