[gnome-shell] unlockDialog: Fix scale-factor handling on multihead
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] unlockDialog: Fix scale-factor handling on multihead
- Date: Tue, 30 Jun 2020 13:19:47 +0000 (UTC)
commit 140ab4dec12be1adf124bc47b486919cca92e135
Author: Florian Müllner <fmuellner gnome org>
Date: Tue Jun 30 13:08:03 2020 +0200
unlockDialog: Fix scale-factor handling on multihead
The blur effect needs to take the scale-factor into account, so we
listen for scale changes. However we set up the signal handler when
creating a background, which is repeated for each monitor, and every
time the monitor configuration changes. But we only disconnect the
last handler that was connected, and only when we are destroyed,
not when recreating backgrounds.
Fix this by splitting out updating the effect parameters to a separate
method that iterates over all backgrounds, so we can simply set up the
handler from the constructor.
https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1341
js/ui/unlockDialog.js | 24 ++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)
---
diff --git a/js/ui/unlockDialog.js b/js/ui/unlockDialog.js
index cbcc2e512f..c6d70d3382 100644
--- a/js/ui/unlockDialog.js
+++ b/js/ui/unlockDialog.js
@@ -524,6 +524,10 @@ var UnlockDialog = GObject.registerClass({
this._bgManagers = [];
+ const themeContext = St.ThemeContext.get_for_stage(global.stage);
+ this._scaleChangedId = themeContext.connect('notify::scale-factor',
+ () => this._updateBackgroundEffects());
+
this._updateBackgrounds();
this._monitorsChangedId =
Main.layoutManager.connect('monitors-changed', this._updateBackgrounds.bind(this));
@@ -626,6 +630,7 @@ var UnlockDialog = GObject.registerClass({
y: monitor.y,
width: monitor.width,
height: monitor.height,
+ effect: new Shell.BlurEffect({ name: 'blur' }),
});
let bgManager = new Background.BackgroundManager({
@@ -637,19 +642,17 @@ var UnlockDialog = GObject.registerClass({
this._bgManagers.push(bgManager);
this._backgroundGroup.add_child(widget);
+ }
+ _updateBackgroundEffects() {
const themeContext = St.ThemeContext.get_for_stage(global.stage);
- let effect = new Shell.BlurEffect({
- brightness: BLUR_BRIGHTNESS,
- sigma: BLUR_SIGMA * themeContext.scale_factor,
- });
-
- this._scaleChangedId = themeContext.connect('notify::scale-factor', () => {
- effect.sigma = BLUR_SIGMA * themeContext.scale_factor;
- });
-
- widget.add_effect(effect);
+ for (const widget of this._backgroundGroup) {
+ widget.get_effect('blur').set({
+ brightness: BLUR_BRIGHTNESS,
+ sigma: BLUR_SIGMA * themeContext.scale_factor,
+ });
+ }
}
_updateBackgrounds() {
@@ -661,6 +664,7 @@ var UnlockDialog = GObject.registerClass({
for (let i = 0; i < Main.layoutManager.monitors.length; i++)
this._createBackground(i);
+ this._updateBackgroundEffects();
}
_ensureAuthPrompt() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]