[gnome-shell/gnome-3-22] osdWindow: relayout when scale factor changes



commit 3679a8cdc4fcdfda188185f5c93f7d223375bca2
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Mon Oct 10 16:56:35 2016 -0700

    osdWindow: relayout when scale factor changes
    
    We currently rely on the "monitors-changed" signal of LayoutManager to
    relayout the OSD window. That is not enough, since the scale factor also
    changes the way the OSD window is sized, and that can be updated after
    "monitors-changed" has been received.
    The visual effect is that under some circumstances, the OSD window will
    have the wrong size under HiDpi.
    
    This commit fixes the issue by triggering another relayout when the
    scale factor changes.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=772723

 js/ui/osdWindow.js |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/js/ui/osdWindow.js b/js/ui/osdWindow.js
index 4cb0f7b..432ea9a 100644
--- a/js/ui/osdWindow.js
+++ b/js/ui/osdWindow.js
@@ -109,8 +109,11 @@ const OsdWindow = new Lang.Class({
         this._reset();
 
         Main.layoutManager.connect('monitors-changed',
-                                   Lang.bind(this, this._monitorsChanged));
-        this._monitorsChanged();
+                                   Lang.bind(this, this._relayout));
+        let themeContext = St.ThemeContext.get_for_stage(global.stage);
+        themeContext.connect('notify::scale-factor',
+                             Lang.bind(this, this._relayout));
+        this._relayout();
         Main.uiGroup.add_child(this.actor);
     },
 
@@ -188,7 +191,7 @@ const OsdWindow = new Lang.Class({
         this.setLevel(null);
     },
 
-    _monitorsChanged: function() {
+    _relayout: function() {
         /* assume 110x110 on a 640x480 display and scale from there */
         let monitor = Main.layoutManager.monitors[this._monitorIndex];
         if (!monitor)


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