loginDialog: Use GObject bindings over onUpdate handler
Instead of iterating over all actors each frame and sync'ing their opacities, we can set up bindings once before the animation. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/654
This commit is contained in:
parent
bf497ed643
commit
3ee525833e
@ -906,25 +906,29 @@ var LoginDialog = GObject.registerClass({
|
|||||||
this._showPrompt();
|
this._showPrompt();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_bindOpacity() {
|
||||||
|
this._bindings = Main.layoutManager.uiGroup.get_children()
|
||||||
|
.filter(c => c != Main.layoutManager.screenShieldGroup)
|
||||||
|
.map(c => this.bind_property('opacity', c, 'opacity', 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
_unbindOpacity() {
|
||||||
|
this._bindings.forEach(b => b.unbind());
|
||||||
|
}
|
||||||
|
|
||||||
_loginScreenSessionActivated() {
|
_loginScreenSessionActivated() {
|
||||||
if (this.opacity == 255 && this._authPrompt.verificationStatus == AuthPrompt.AuthPromptStatus.NOT_VERIFYING)
|
if (this.opacity == 255 && this._authPrompt.verificationStatus == AuthPrompt.AuthPromptStatus.NOT_VERIFYING)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
this._bindOpacity();
|
||||||
Tweener.addTween(this,
|
Tweener.addTween(this,
|
||||||
{ opacity: 255,
|
{ opacity: 255,
|
||||||
time: _FADE_ANIMATION_TIME / 1000,
|
time: _FADE_ANIMATION_TIME / 1000,
|
||||||
transition: 'easeOutQuad',
|
transition: 'easeOutQuad',
|
||||||
onUpdate: () => {
|
|
||||||
let children = Main.layoutManager.uiGroup.get_children();
|
|
||||||
|
|
||||||
for (let i = 0; i < children.length; i++) {
|
|
||||||
if (children[i] != Main.layoutManager.screenShieldGroup)
|
|
||||||
children[i].opacity = this.opacity;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onComplete: () => {
|
onComplete: () => {
|
||||||
if (this._authPrompt.verificationStatus != AuthPrompt.AuthPromptStatus.NOT_VERIFYING)
|
if (this._authPrompt.verificationStatus != AuthPrompt.AuthPromptStatus.NOT_VERIFYING)
|
||||||
this._authPrompt.reset();
|
this._authPrompt.reset();
|
||||||
|
this._unbindOpacity();
|
||||||
} });
|
} });
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -938,20 +942,14 @@ var LoginDialog = GObject.registerClass({
|
|||||||
}
|
}
|
||||||
|
|
||||||
_startSession(serviceName) {
|
_startSession(serviceName) {
|
||||||
|
this._bindOpacity();
|
||||||
Tweener.addTween(this,
|
Tweener.addTween(this,
|
||||||
{ opacity: 0,
|
{ opacity: 0,
|
||||||
time: _FADE_ANIMATION_TIME / 1000,
|
time: _FADE_ANIMATION_TIME / 1000,
|
||||||
transition: 'easeOutQuad',
|
transition: 'easeOutQuad',
|
||||||
onUpdate: () => {
|
|
||||||
let children = Main.layoutManager.uiGroup.get_children();
|
|
||||||
|
|
||||||
for (let i = 0; i < children.length; i++) {
|
|
||||||
if (children[i] != Main.layoutManager.screenShieldGroup)
|
|
||||||
children[i].opacity = this.opacity;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onComplete: () => {
|
onComplete: () => {
|
||||||
this._greeter.call_start_session_when_ready_sync(serviceName, true, null);
|
this._greeter.call_start_session_when_ready_sync(serviceName, true, null);
|
||||||
|
this._unbindOpacity();
|
||||||
} });
|
} });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user