From 0a54118a52d5186b0b6c2e190522693f9b371a78 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Wed, 6 Feb 2019 16:07:27 -0500 Subject: [PATCH] loginDialog: stop timed login when VT switching away At the moment, the timed login timer continues along even after the user logs in. That's wrong, the login screen should be dormant when the VT isn't active. This commit makes sure we turn off timed login when the user is about to be logged in and when the user switches VTs. --- js/gdm/loginDialog.js | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js index cb2a69ef8..dbf0525ec 100644 --- a/js/gdm/loginDialog.js +++ b/js/gdm/loginDialog.js @@ -937,6 +937,8 @@ var LoginDialog = GObject.registerClass({ } _loginScreenSessionDeactivated() { + this._stopTimedLogin(); + if (this._greeter) { this._greeter.run_dispose(); this._greeter = null; @@ -978,6 +980,8 @@ var LoginDialog = GObject.registerClass({ } _onSessionOpened(client, serviceName) { + this._stopTimedLogin(); + this._authPrompt.finish(() => { this._startSession(serviceName); }); } @@ -1014,22 +1018,27 @@ var LoginDialog = GObject.registerClass({ return hold; } + _stopTimedLogin() { + if (this._timedLoginBatch) { + this._timedLoginBatch.cancel(); + this._timedLoginBatch = null; + } + + if (this._timedLoginIdleTimeOutId) { + GLib.source_remove(this._timedLoginIdleTimeOutId); + this._timedLoginIdleTimeOutId = 0; + } + } + _startTimedLogin(userName, delay) { let firstRun = true; // Cancel execution of old batch if (this._timedLoginBatch) { - this._timedLoginBatch.cancel(); - this._timedLoginBatch = null; + this._stopTimedLogin(); firstRun = false; } - // Reset previous idle-timeout - if (this._timedLoginIdleTimeOutId) { - GLib.source_remove(this._timedLoginIdleTimeOutId); - this._timedLoginIdleTimeOutId = 0; - } - let loginItem = null; let animationTime;