loginDialog: Ensure timed login indicator is hidden on key presses

The timed login feature currently cancels the timed login operation when
a user presses a key but, oddly, only hides the indicator when the user
releases the key. This means that if a user holds down a key that
doesn't key repeat, the timed login indicator will continue to run after
the timed login operation is cancelled.

This commit address the problem by ensuring the timed login indicator is
hidden on any key press event, at the same time the timed login
operation is canceled.
This commit is contained in:
verdre 2018-04-17 14:30:05 +02:00
parent 35fced27df
commit d7aba2dece

View File

@ -1073,18 +1073,13 @@ var LoginDialog = new Lang.Class({
_onTimedLoginRequested(client, userName, seconds) {
this._startTimedLogin(userName, seconds);
// Restart timed login on user interaction
global.stage.connect('captured-event', (actor, event) => {
if (this._timedLoginDelay == undefined)
return Clutter.EVENT_PROPAGATE;
if (event.type() == Clutter.EventType.KEY_PRESS ||
event.type() == Clutter.EventType.BUTTON_PRESS) {
if (this._timedLoginBatch) {
this._timedLoginBatch.cancel();
this._timedLoginBatch = null;
}
} else if (event.type() == Clutter.EventType.KEY_RELEASE ||
event.type() == Clutter.EventType.BUTTON_RELEASE) {
this._resetTimedLogin();
}