[gnome-shell/gbsneto/new-lock-screen] unlockDialog: Add blurred background
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/gbsneto/new-lock-screen] unlockDialog: Add blurred background
- Date: Mon, 7 Oct 2019 17:18:20 +0000 (UTC)
commit e7b208eae4f2fee2ce2be5a442cc88704669fc2b
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Mon Oct 7 14:17:35 2019 -0300
unlockDialog: Add blurred background
This code is mostly copied from ScreenShield.
js/ui/unlockDialog.js | 44 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)
---
diff --git a/js/ui/unlockDialog.js b/js/ui/unlockDialog.js
index 5af1b4823f..8d6b62cd18 100644
--- a/js/ui/unlockDialog.js
+++ b/js/ui/unlockDialog.js
@@ -11,6 +11,7 @@ const AuthPrompt = imports.gdm.authPrompt;
// The timeout before going back automatically to the lock screen (in seconds)
const IDLE_TIMEOUT = 2 * 60;
+const SCREENSAVER_SCHEMA = 'org.gnome.desktop.screensaver';
var UnlockDialog = GObject.registerClass({
Signals: { 'failed': {} },
@@ -26,6 +27,16 @@ var UnlockDialog = GObject.registerClass({
this.add_constraint(new Layout.MonitorConstraint({ primary: true }));
parentActor.add_child(this);
+ this._backgroundGroup = new Clutter.Actor();
+ this._backgroundGroup.add_effect_with_name(
+ 'blur', new Clutter.BlurEffect());
+ this.add_child(this._backgroundGroup);
+ this._backgroundGroup.lower_bottom();
+ this._bgManagers = [];
+
+ this._updateBackgrounds();
+ Main.layoutManager.connect('monitors-changed', this._updateBackgrounds.bind(this));
+
this._userManager = AccountsService.UserManager.get_default();
this._userName = GLib.get_user_name();
this._user = this._userManager.get_user(this._userName);
@@ -75,6 +86,39 @@ var UnlockDialog = GObject.registerClass({
this.connect('destroy', this._onDestroy.bind(this));
}
+ _updateBackgrounds() {
+ for (let bgManager of this._bgManagers)
+ bgManager.destroy();
+
+ this._bgManagers = [];
+ this._backgroundGroup.destroy_all_children();
+
+ for (let i = 0; i < Main.layoutManager.monitors.length; i++)
+ this._createBackground(i);
+ }
+
+ _createBackground(monitorIndex) {
+ let monitor = Main.layoutManager.monitors[monitorIndex];
+ let widget = new St.Widget({
+ style_class: 'screen-shield-background',
+ x: monitor.x,
+ y: monitor.y,
+ width: monitor.width,
+ height: monitor.height,
+ });
+
+ let bgManager = new Background.BackgroundManager({
+ container: widget,
+ monitorIndex: monitorIndex,
+ controlPosition: false,
+ settingsSchema: SCREENSAVER_SCHEMA,
+ });
+
+ this._bgManagers.push(bgManager);
+
+ this._backgroundGroup.add_child(widget);
+ }
+
_updateSensitivity(sensitive) {
this._authPrompt.updateSensitivity(sensitive);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]