From 3679a8cdc4fcdfda188185f5c93f7d223375bca2 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Mon, 10 Oct 2016 16:56:35 -0700 Subject: [PATCH] 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 file changed, 6 insertions(+), 3 deletions(-) diff --git a/js/ui/osdWindow.js b/js/ui/osdWindow.js index 4cb0f7b4f..432ea9af7 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)