screenShield: Move background to Unlock Dialog
In addition to that, remove the ClutterBoxLayout that is set as the layout manager of the Unlock Dialog, and apply the primary monitor constraint to the child St.BoxLayout instead. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/872
This commit is contained in:
parent
2b39d6e95a
commit
15b59414d6
@ -4,7 +4,6 @@ const { AccountsService, Clutter, Gio,
|
|||||||
GLib, Graphene, Meta, Shell, St } = imports.gi;
|
GLib, Graphene, Meta, Shell, St } = imports.gi;
|
||||||
const Signals = imports.signals;
|
const Signals = imports.signals;
|
||||||
|
|
||||||
const Background = imports.ui.background;
|
|
||||||
const GnomeSession = imports.misc.gnomeSession;
|
const GnomeSession = imports.misc.gnomeSession;
|
||||||
const Layout = imports.ui.layout;
|
const Layout = imports.ui.layout;
|
||||||
const OVirt = imports.gdm.oVirt;
|
const OVirt = imports.gdm.oVirt;
|
||||||
@ -76,15 +75,6 @@ var ScreenShield = class {
|
|||||||
|
|
||||||
this._lockScreenGroup.add_actor(this._lockScreenContents);
|
this._lockScreenGroup.add_actor(this._lockScreenContents);
|
||||||
|
|
||||||
this._backgroundGroup = new Clutter.Actor();
|
|
||||||
|
|
||||||
this._lockScreenGroup.add_actor(this._backgroundGroup);
|
|
||||||
this._lockScreenGroup.set_child_below_sibling(this._backgroundGroup, null);
|
|
||||||
this._bgManagers = [];
|
|
||||||
|
|
||||||
this._updateBackgrounds();
|
|
||||||
Main.layoutManager.connect('monitors-changed', this._updateBackgrounds.bind(this));
|
|
||||||
|
|
||||||
this._dragAction = new Clutter.GestureAction();
|
this._dragAction = new Clutter.GestureAction();
|
||||||
this._dragAction.connect('gesture-begin', this._onDragBegin.bind(this));
|
this._dragAction.connect('gesture-begin', this._onDragBegin.bind(this));
|
||||||
this._dragAction.connect('gesture-progress', this._onDragMotion.bind(this));
|
this._dragAction.connect('gesture-progress', this._onDragMotion.bind(this));
|
||||||
@ -190,35 +180,6 @@ var ScreenShield = class {
|
|||||||
this._syncInhibitor();
|
this._syncInhibitor();
|
||||||
}
|
}
|
||||||
|
|
||||||
_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,
|
|
||||||
controlPosition: false,
|
|
||||||
settingsSchema: SCREENSAVER_SCHEMA });
|
|
||||||
|
|
||||||
this._bgManagers.push(bgManager);
|
|
||||||
|
|
||||||
this._backgroundGroup.add_child(widget);
|
|
||||||
}
|
|
||||||
|
|
||||||
_updateBackgrounds() {
|
|
||||||
for (let i = 0; i < this._bgManagers.length; i++)
|
|
||||||
this._bgManagers[i].destroy();
|
|
||||||
|
|
||||||
this._bgManagers = [];
|
|
||||||
this._backgroundGroup.destroy_all_children();
|
|
||||||
|
|
||||||
for (let i = 0; i < Main.layoutManager.monitors.length; i++)
|
|
||||||
this._createBackground(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
_liftShield(velocity) {
|
_liftShield(velocity) {
|
||||||
if (this._isLocked) {
|
if (this._isLocked) {
|
||||||
if (this._ensureUnlockDialog(true /* allowCancel */))
|
if (this._ensureUnlockDialog(true /* allowCancel */))
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
const { AccountsService, Atk, Clutter, Gdm, Gio,
|
const { AccountsService, Atk, Clutter, Gdm, Gio,
|
||||||
GnomeDesktop, GLib, GObject, Meta, Shell, St } = imports.gi;
|
GnomeDesktop, GLib, GObject, Meta, Shell, St } = imports.gi;
|
||||||
|
|
||||||
|
const Background = imports.ui.background;
|
||||||
const Layout = imports.ui.layout;
|
const Layout = imports.ui.layout;
|
||||||
const Main = imports.ui.main;
|
const Main = imports.ui.main;
|
||||||
const MessageTray = imports.ui.messageTray;
|
const MessageTray = imports.ui.messageTray;
|
||||||
@ -13,6 +14,8 @@ const AuthPrompt = imports.gdm.authPrompt;
|
|||||||
// The timeout before going back automatically to the lock screen (in seconds)
|
// The timeout before going back automatically to the lock screen (in seconds)
|
||||||
const IDLE_TIMEOUT = 2 * 60;
|
const IDLE_TIMEOUT = 2 * 60;
|
||||||
|
|
||||||
|
const SCREENSAVER_SCHEMA = 'org.gnome.desktop.screensaver';
|
||||||
|
|
||||||
const SUMMARY_ICON_SIZE = 48;
|
const SUMMARY_ICON_SIZE = 48;
|
||||||
|
|
||||||
var NotificationsBox = GObject.registerClass({
|
var NotificationsBox = GObject.registerClass({
|
||||||
@ -333,13 +336,21 @@ var UnlockDialog = GObject.registerClass({
|
|||||||
super._init({
|
super._init({
|
||||||
accessible_role: Atk.Role.WINDOW,
|
accessible_role: Atk.Role.WINDOW,
|
||||||
style_class: 'login-dialog',
|
style_class: 'login-dialog',
|
||||||
layout_manager: new Clutter.BoxLayout(),
|
|
||||||
visible: false,
|
visible: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add_constraint(new Layout.MonitorConstraint({ primary: true }));
|
|
||||||
parentActor.add_child(this);
|
parentActor.add_child(this);
|
||||||
|
|
||||||
|
// Background
|
||||||
|
this._backgroundGroup = new Clutter.Actor();
|
||||||
|
this.add_child(this._backgroundGroup);
|
||||||
|
|
||||||
|
this._bgManagers = [];
|
||||||
|
|
||||||
|
this._updateBackgrounds();
|
||||||
|
this._monitorsChangedId =
|
||||||
|
Main.layoutManager.connect('monitors-changed', this._updateBackgrounds.bind(this));
|
||||||
|
|
||||||
this._userManager = AccountsService.UserManager.get_default();
|
this._userManager = AccountsService.UserManager.get_default();
|
||||||
this._userName = GLib.get_user_name();
|
this._userName = GLib.get_user_name();
|
||||||
this._user = this._userManager.get_user(this._userName);
|
this._user = this._userManager.get_user(this._userName);
|
||||||
@ -350,6 +361,7 @@ var UnlockDialog = GObject.registerClass({
|
|||||||
x_expand: true,
|
x_expand: true,
|
||||||
y_expand: true });
|
y_expand: true });
|
||||||
this.add_child(this._promptBox);
|
this.add_child(this._promptBox);
|
||||||
|
this._promptBox.add_constraint(new Layout.MonitorConstraint({ primary: true }));
|
||||||
|
|
||||||
this._clock = new Clock();
|
this._clock = new Clock();
|
||||||
this._promptBox.add_child(this._clock);
|
this._promptBox.add_child(this._clock);
|
||||||
@ -394,6 +406,39 @@ var UnlockDialog = GObject.registerClass({
|
|||||||
this.connect('destroy', this._onDestroy.bind(this));
|
this.connect('destroy', this._onDestroy.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_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,
|
||||||
|
controlPosition: false,
|
||||||
|
settingsSchema: SCREENSAVER_SCHEMA,
|
||||||
|
});
|
||||||
|
|
||||||
|
this._bgManagers.push(bgManager);
|
||||||
|
|
||||||
|
this._backgroundGroup.add_child(widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
_updateBackgrounds() {
|
||||||
|
for (let i = 0; i < this._bgManagers.length; i++)
|
||||||
|
this._bgManagers[i].destroy();
|
||||||
|
|
||||||
|
this._bgManagers = [];
|
||||||
|
this._backgroundGroup.destroy_all_children();
|
||||||
|
|
||||||
|
for (let i = 0; i < Main.layoutManager.monitors.length; i++)
|
||||||
|
this._createBackground(i);
|
||||||
|
}
|
||||||
|
|
||||||
_updateSensitivity(sensitive) {
|
_updateSensitivity(sensitive) {
|
||||||
this._authPrompt.updateSensitivity(sensitive);
|
this._authPrompt.updateSensitivity(sensitive);
|
||||||
|
|
||||||
@ -437,6 +482,11 @@ var UnlockDialog = GObject.registerClass({
|
|||||||
this._idleMonitor.remove_watch(this._idleWatchId);
|
this._idleMonitor.remove_watch(this._idleWatchId);
|
||||||
this._idleWatchId = 0;
|
this._idleWatchId = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this._monitorsChangedId) {
|
||||||
|
Main.layoutManager.disconnect(this._monitorsChangedId);
|
||||||
|
delete this._monitorsChangedId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cancel() {
|
cancel() {
|
||||||
|
Loading…
Reference in New Issue
Block a user