[gnome-shell] Resize the user's avatar when scaling factor changes



commit b8eeac6fcf5505736b94d35dea0ece40caa048c9
Author: Mario Sanchez Prada <mario endlessm com>
Date:   Thu Aug 10 16:21:50 2017 +0100

    Resize the user's avatar when scaling factor changes
    
    We need to consider the scaling factor in effect when updating the user's
    avatar, and also make sure to update it as well whenever the scaling
    factor changes.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=786120

 js/ui/userWidget.js |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/userWidget.js b/js/ui/userWidget.js
index 966439f..5c56fe4 100644
--- a/js/ui/userWidget.js
+++ b/js/ui/userWidget.js
@@ -35,6 +35,10 @@ var Avatar = new Lang.Class({
                                   reactive: params.reactive,
                                   width: this._iconSize * scaleFactor,
                                   height: this._iconSize * scaleFactor });
+
+        // Monitor the scaling factor to make sure we recreate the avatar when needed.
+        let themeContext = St.ThemeContext.get_for_stage(global.stage);
+        themeContext.connect('notify::scale-factor', Lang.bind(this, this.update));
     },
 
     setSensitive: function(sensitive) {
@@ -56,6 +60,9 @@ var Avatar = new Lang.Class({
             this.actor.child = new St.Icon({ icon_name: 'avatar-default-symbolic',
                                              icon_size: this._iconSize });
         }
+
+        let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
+        this.actor.set_size(this._iconSize * scaleFactor, this._iconSize * scaleFactor);
     }
 });
 


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