ScreenShield: don't bump the lock screen while animating
Bumping overrides any animation, and causes the installed onComplete not to run, which in turn breaks suspending from the user menu (as it listens to lock-screen-shown). Add a state variable (using an enumeration shared with messageTray) to control the lock screen, and only bump when the lock is still. https://bugzilla.gnome.org/show_bug.cgi?id=682746
This commit is contained in:
parent
50e5736c03
commit
9dafaa2c0c
@ -282,6 +282,7 @@ const ScreenShield = new Lang.Class({
|
|||||||
_init: function() {
|
_init: function() {
|
||||||
this.actor = Main.layoutManager.screenShieldGroup;
|
this.actor = Main.layoutManager.screenShieldGroup;
|
||||||
|
|
||||||
|
this._lockScreenState = MessageTray.State.HIDDEN;
|
||||||
this._lockScreenGroup = new St.Widget({ x_expand: true,
|
this._lockScreenGroup = new St.Widget({ x_expand: true,
|
||||||
y_expand: true,
|
y_expand: true,
|
||||||
reactive: true,
|
reactive: true,
|
||||||
@ -365,10 +366,10 @@ const ScreenShield = new Lang.Class({
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the dialog is created, but hasn't received focus yet,
|
// Don't bump if the lock screen is not showing or is
|
||||||
// the lock screen could be still focused, so bumping would
|
// animating, as the bump overrides the animation and would
|
||||||
// make the curtain fall again.
|
// remove any onComplete handler
|
||||||
if (!this._dialog)
|
if (this._lockScreenState == MessageTray.State.SHOWN)
|
||||||
this._bumpLockScreen();
|
this._bumpLockScreen();
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
@ -388,6 +389,7 @@ const ScreenShield = new Lang.Class({
|
|||||||
|
|
||||||
_onDragBegin: function() {
|
_onDragBegin: function() {
|
||||||
Tweener.removeTweens(this._lockScreenGroup);
|
Tweener.removeTweens(this._lockScreenGroup);
|
||||||
|
this._lockScreenState = MessageTray.State.HIDING;
|
||||||
this._ensureUnlockDialog();
|
this._ensureUnlockDialog();
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -406,8 +408,10 @@ const ScreenShield = new Lang.Class({
|
|||||||
time: time,
|
time: time,
|
||||||
transition: 'linear',
|
transition: 'linear',
|
||||||
onComplete: function() {
|
onComplete: function() {
|
||||||
this.fixed_position_set = false;
|
this._lockScreenGroup.fixed_position_set = false;
|
||||||
}
|
this._lockScreenState = MessageTray.State.SHOWN;
|
||||||
|
},
|
||||||
|
onCompleteScope: this,
|
||||||
});
|
});
|
||||||
|
|
||||||
// If we have a unlock dialog, cancel it
|
// If we have a unlock dialog, cancel it
|
||||||
@ -471,6 +475,8 @@ const ScreenShield = new Lang.Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
_hideLockScreen: function(animate) {
|
_hideLockScreen: function(animate) {
|
||||||
|
this._lockScreenState = MessageTray.State.HIDING;
|
||||||
|
|
||||||
if (animate) {
|
if (animate) {
|
||||||
// Tween the lock screen out of screen
|
// Tween the lock screen out of screen
|
||||||
// try to use the same speed regardless of original position
|
// try to use the same speed regardless of original position
|
||||||
@ -481,13 +487,21 @@ const ScreenShield = new Lang.Class({
|
|||||||
{ y: -h,
|
{ y: -h,
|
||||||
time: time,
|
time: time,
|
||||||
transition: 'linear',
|
transition: 'linear',
|
||||||
onComplete: function() { this.hide(); }
|
onComplete: function() {
|
||||||
|
this._lockScreenHidden();
|
||||||
|
},
|
||||||
|
onCompleteScope: this,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this._lockScreenGroup.hide();
|
this._lockScreenHidden();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_lockScreenHidden: function() {
|
||||||
|
this._lockScreenState = MessageTray.State.HIDDEN;
|
||||||
|
this._lockScreenGroup.hide();
|
||||||
|
},
|
||||||
|
|
||||||
_ensureUnlockDialog: function() {
|
_ensureUnlockDialog: function() {
|
||||||
if (!this._dialog) {
|
if (!this._dialog) {
|
||||||
[this._dialog, this._keepDialog] = Main.sessionMode.createUnlockDialog(this._lockDialogGroup);
|
[this._dialog, this._keepDialog] = Main.sessionMode.createUnlockDialog(this._lockDialogGroup);
|
||||||
@ -531,6 +545,7 @@ const ScreenShield = new Lang.Class({
|
|||||||
|
|
||||||
_resetLockScreen: function(animate) {
|
_resetLockScreen: function(animate) {
|
||||||
this._lockScreenGroup.show();
|
this._lockScreenGroup.show();
|
||||||
|
this._lockScreenState = MessageTray.State.SHOWING;
|
||||||
|
|
||||||
if (animate) {
|
if (animate) {
|
||||||
this._lockScreenGroup.y = -global.screen_height;
|
this._lockScreenGroup.y = -global.screen_height;
|
||||||
@ -540,8 +555,7 @@ const ScreenShield = new Lang.Class({
|
|||||||
time: SHORT_FADE_TIME,
|
time: SHORT_FADE_TIME,
|
||||||
transition: 'linear',
|
transition: 'linear',
|
||||||
onComplete: function() {
|
onComplete: function() {
|
||||||
this._lockScreenGroup.fixed_position_set = false;
|
this._lockScreenShown();
|
||||||
this.emit('lock-screen-shown');
|
|
||||||
},
|
},
|
||||||
onCompleteScope: this
|
onCompleteScope: this
|
||||||
});
|
});
|
||||||
@ -553,14 +567,20 @@ const ScreenShield = new Lang.Class({
|
|||||||
time: SHORT_FADE_TIME,
|
time: SHORT_FADE_TIME,
|
||||||
transition: 'easeOutQuad' });
|
transition: 'easeOutQuad' });
|
||||||
} else {
|
} else {
|
||||||
this._lockScreenGroup.fixed_position_set = false;
|
|
||||||
this._lockDialogGroup.opacity = 255;
|
this._lockDialogGroup.opacity = 255;
|
||||||
this.emit('lock-screen-shown');
|
this._lockScreenShown();
|
||||||
}
|
}
|
||||||
|
|
||||||
this._lockScreenGroup.grab_key_focus();
|
this._lockScreenGroup.grab_key_focus();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_lockScreenShown: function() {
|
||||||
|
this._lockScreenState = MessageTray.State.SHOWN;
|
||||||
|
this._lockScreenGroup.fixed_position_set = false;
|
||||||
|
|
||||||
|
this.emit('lock-screen-shown');
|
||||||
|
},
|
||||||
|
|
||||||
// Some of the actors in the lock screen are heavy in
|
// Some of the actors in the lock screen are heavy in
|
||||||
// resources, so we only create them when needed
|
// resources, so we only create them when needed
|
||||||
_prepareLockScreen: function() {
|
_prepareLockScreen: function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user