unlockDialog: Toggle between clock and auth prompt
Toggle between them when (1) tapping anythere on the screen, and (2) pressing any key. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/872
This commit is contained in:
parent
b59c9c6946
commit
b9c7631a55
@ -16,6 +16,8 @@ const IDLE_TIMEOUT = 2 * 60;
|
||||
|
||||
const SCREENSAVER_SCHEMA = 'org.gnome.desktop.screensaver';
|
||||
|
||||
const CROSSFADE_TIME = 300;
|
||||
|
||||
const BLUR_BRIGHTNESS = 0.55;
|
||||
const BLUR_RADIUS = 200;
|
||||
|
||||
@ -400,10 +402,17 @@ var UnlockDialog = GObject.registerClass({
|
||||
accessible_role: Atk.Role.WINDOW,
|
||||
style_class: 'login-dialog',
|
||||
visible: false,
|
||||
reactive: true,
|
||||
});
|
||||
|
||||
parentActor.add_child(this);
|
||||
|
||||
this._activePage = null;
|
||||
|
||||
let tapAction = new Clutter.TapAction();
|
||||
tapAction.connect('tap', this._showPrompt.bind(this));
|
||||
this.add_action(tapAction);
|
||||
|
||||
// Background
|
||||
this._backgroundGroup = new Clutter.Actor();
|
||||
this.add_child(this._backgroundGroup);
|
||||
@ -426,6 +435,7 @@ var UnlockDialog = GObject.registerClass({
|
||||
|
||||
this._clock = new Clock();
|
||||
stack.add_child(this._clock);
|
||||
this._showClock();
|
||||
|
||||
this._authPrompt = new AuthPrompt.AuthPrompt(new Gdm.Client(), AuthPrompt.AuthPromptMode.UNLOCK_ONLY);
|
||||
this._authPrompt.connect('failed', this._fail.bind(this));
|
||||
@ -476,6 +486,21 @@ var UnlockDialog = GObject.registerClass({
|
||||
this.connect('destroy', this._onDestroy.bind(this));
|
||||
}
|
||||
|
||||
vfunc_key_press_event(keyEvent) {
|
||||
if (this._activePage === this._promptBox ||
|
||||
(this._promptBox && this._promptBox.visible))
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
|
||||
let unichar = keyEvent.unicode_value;
|
||||
|
||||
this._showPrompt();
|
||||
|
||||
if (GLib.unichar_isgraph(unichar))
|
||||
this.addCharacter(unichar);
|
||||
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
}
|
||||
|
||||
_createBackground(monitorIndex) {
|
||||
let monitor = Main.layoutManager.monitors[monitorIndex];
|
||||
let widget = new St.Widget({
|
||||
@ -523,6 +548,48 @@ var UnlockDialog = GObject.registerClass({
|
||||
}
|
||||
}
|
||||
|
||||
_showClock() {
|
||||
if (this._activePage === this._clock)
|
||||
return;
|
||||
|
||||
this._activePage = this._clock;
|
||||
this._clock.show();
|
||||
|
||||
this._promptBox.ease({
|
||||
opacity: 0,
|
||||
duration: CROSSFADE_TIME,
|
||||
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
||||
onComplete: () => this._promptBox.hide(),
|
||||
});
|
||||
|
||||
this._clock.ease({
|
||||
opacity: 255,
|
||||
duration: CROSSFADE_TIME,
|
||||
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
||||
});
|
||||
}
|
||||
|
||||
_showPrompt() {
|
||||
if (this._activePage === this._promptBox)
|
||||
return;
|
||||
|
||||
this._activePage = this._promptBox;
|
||||
this._promptBox.show();
|
||||
|
||||
this._clock.ease({
|
||||
opacity: 0,
|
||||
duration: CROSSFADE_TIME,
|
||||
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
||||
onComplete: () => this._clock.hide(),
|
||||
});
|
||||
|
||||
this._promptBox.ease({
|
||||
opacity: 255,
|
||||
duration: CROSSFADE_TIME,
|
||||
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
||||
});
|
||||
}
|
||||
|
||||
_fail() {
|
||||
this.emit('failed');
|
||||
}
|
||||
@ -569,6 +636,7 @@ var UnlockDialog = GObject.registerClass({
|
||||
}
|
||||
|
||||
addCharacter(unichar) {
|
||||
this._showPrompt();
|
||||
this._authPrompt.addCharacter(unichar);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user