unlockDialog: Move auth prompt and clock to a ShellStack
We will toggle between each other in the next commit, so add both to a ShellStack. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/872
This commit is contained in:
parent
f02313c1c6
commit
b59c9c6946
@ -331,19 +331,19 @@ class UnlockDialogClock extends St.BoxLayout {
|
|||||||
|
|
||||||
var UnlockDialogLayout = GObject.registerClass(
|
var UnlockDialogLayout = GObject.registerClass(
|
||||||
class UnlockDialogLayout extends Clutter.LayoutManager {
|
class UnlockDialogLayout extends Clutter.LayoutManager {
|
||||||
_init(authBox, notifications) {
|
_init(stack, notifications) {
|
||||||
super._init();
|
super._init();
|
||||||
|
|
||||||
this._authBox = authBox;
|
this._stack = stack;
|
||||||
this._notifications = notifications;
|
this._notifications = notifications;
|
||||||
}
|
}
|
||||||
|
|
||||||
vfunc_get_preferred_width(container, forHeight) {
|
vfunc_get_preferred_width(container, forHeight) {
|
||||||
return this._authBox.get_preferred_width(forHeight);
|
return this._stack.get_preferred_width(forHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
vfunc_get_preferred_height(container, forWidth) {
|
vfunc_get_preferred_height(container, forWidth) {
|
||||||
return this._authBox.get_preferred_height(forWidth);
|
return this._stack.get_preferred_height(forWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
vfunc_allocate(container, box, flags) {
|
vfunc_allocate(container, box, flags) {
|
||||||
@ -352,13 +352,13 @@ class UnlockDialogLayout extends Clutter.LayoutManager {
|
|||||||
let tenthOfHeight = height / 10.0;
|
let tenthOfHeight = height / 10.0;
|
||||||
let thirdOfHeight = height / 3.0;
|
let thirdOfHeight = height / 3.0;
|
||||||
|
|
||||||
let [, , authBoxWidth, authBoxHeight] =
|
let [, , stackWidth, stackHeight] =
|
||||||
this._authBox.get_preferred_size();
|
this._stack.get_preferred_size();
|
||||||
|
|
||||||
let [, , notificationsWidth, notificationsHeight] =
|
let [, , notificationsWidth, notificationsHeight] =
|
||||||
this._notifications.get_preferred_size();
|
this._notifications.get_preferred_size();
|
||||||
|
|
||||||
let columnWidth = Math.max(authBoxWidth, notificationsWidth);
|
let columnWidth = Math.max(stackWidth, notificationsWidth);
|
||||||
|
|
||||||
let columnX1 = Math.floor((width - columnWidth) / 2.0);
|
let columnX1 = Math.floor((width - columnWidth) / 2.0);
|
||||||
let actorBox = new Clutter.ActorBox();
|
let actorBox = new Clutter.ActorBox();
|
||||||
@ -366,7 +366,7 @@ class UnlockDialogLayout extends Clutter.LayoutManager {
|
|||||||
// Notifications
|
// Notifications
|
||||||
let maxNotificationsHeight = Math.min(
|
let maxNotificationsHeight = Math.min(
|
||||||
notificationsHeight,
|
notificationsHeight,
|
||||||
height - tenthOfHeight - authBoxHeight);
|
height - tenthOfHeight - stackHeight);
|
||||||
|
|
||||||
actorBox.x1 = columnX1;
|
actorBox.x1 = columnX1;
|
||||||
actorBox.y1 = height - maxNotificationsHeight;
|
actorBox.y1 = height - maxNotificationsHeight;
|
||||||
@ -376,16 +376,16 @@ class UnlockDialogLayout extends Clutter.LayoutManager {
|
|||||||
this._notifications.allocate(actorBox, flags);
|
this._notifications.allocate(actorBox, flags);
|
||||||
|
|
||||||
// Authentication Box
|
// Authentication Box
|
||||||
let authBoxY = Math.min(
|
let stackY = Math.min(
|
||||||
thirdOfHeight,
|
thirdOfHeight,
|
||||||
height - authBoxHeight - maxNotificationsHeight);
|
height - stackHeight - maxNotificationsHeight);
|
||||||
|
|
||||||
actorBox.x1 = columnX1;
|
actorBox.x1 = columnX1;
|
||||||
actorBox.y1 = authBoxY;
|
actorBox.y1 = stackY;
|
||||||
actorBox.x2 = columnX1 + columnWidth;
|
actorBox.x2 = columnX1 + columnWidth;
|
||||||
actorBox.y2 = authBoxY + authBoxHeight;
|
actorBox.y2 = stackY + stackHeight;
|
||||||
|
|
||||||
this._authBox.allocate(actorBox, flags);
|
this._stack.allocate(actorBox, flags);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -418,10 +418,14 @@ var UnlockDialog = GObject.registerClass({
|
|||||||
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);
|
||||||
|
|
||||||
|
// Authentication & Clock stack
|
||||||
|
let stack = new Shell.Stack();
|
||||||
|
|
||||||
this._promptBox = new St.BoxLayout({ vertical: true });
|
this._promptBox = new St.BoxLayout({ vertical: true });
|
||||||
|
stack.add_child(this._promptBox);
|
||||||
|
|
||||||
this._clock = new Clock();
|
this._clock = new Clock();
|
||||||
this._promptBox.add_child(this._clock);
|
stack.add_child(this._clock);
|
||||||
|
|
||||||
this._authPrompt = new AuthPrompt.AuthPrompt(new Gdm.Client(), AuthPrompt.AuthPromptMode.UNLOCK_ONLY);
|
this._authPrompt = new AuthPrompt.AuthPrompt(new Gdm.Client(), AuthPrompt.AuthPromptMode.UNLOCK_ONLY);
|
||||||
this._authPrompt.connect('failed', this._fail.bind(this));
|
this._authPrompt.connect('failed', this._fail.bind(this));
|
||||||
@ -459,10 +463,10 @@ var UnlockDialog = GObject.registerClass({
|
|||||||
// Main Box
|
// Main Box
|
||||||
let mainBox = new Clutter.Actor();
|
let mainBox = new Clutter.Actor();
|
||||||
mainBox.add_constraint(new Layout.MonitorConstraint({ primary: true }));
|
mainBox.add_constraint(new Layout.MonitorConstraint({ primary: true }));
|
||||||
mainBox.add_child(this._promptBox);
|
mainBox.add_child(stack);
|
||||||
mainBox.add_child(this._notificationsBox);
|
mainBox.add_child(this._notificationsBox);
|
||||||
mainBox.layout_manager = new UnlockDialogLayout(
|
mainBox.layout_manager = new UnlockDialogLayout(
|
||||||
this._promptBox,
|
stack,
|
||||||
this._notificationsBox);
|
this._notificationsBox);
|
||||||
this.add_child(mainBox);
|
this.add_child(mainBox);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user