Skip to content

Commit c515147

Browse files
committed
loginManager: add sessionIsActive property updated when ActiveChanged
fires from logind/ck.
1 parent ab9adeb commit c515147

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

js/misc/loginManager.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ var LoginManagerSystemd = class {
7979
constructor() {
8080
this._managerProxy = null;
8181
this._sessionProxy = null;
82-
this.isLocked = false;
82+
this.sessionIsActive = true;
8383

8484
this._initSession();
8585
}
@@ -163,14 +163,13 @@ var LoginManagerSystemd = class {
163163
this._sessionProxy.connect('g-properties-changed', (proxy, changed, invalidated) => {
164164
if ('Active' in changed.deep_unpack()) {
165165
let active = this._sessionProxy.Active;
166+
this.sessionIsActive = active;
166167
_log(`LoginManager: Session Active property changed: ${active}`);
167-
if (active) {
168-
_log('LoginManager: Session became active, emitting active');
169-
this.emit('active');
170-
}
168+
this.emit('active-changed', active);
171169
}
172170
});
173171

172+
this.sessionIsActive = this._sessionProxy.Active;
174173
this.emit('session-ready');
175174
} catch (e) {
176175
global.logError('LoginManager: Failed to connect to logind session: ' + e.message);
@@ -230,6 +229,7 @@ var LoginManagerConsoleKit = class {
230229
constructor() {
231230
this._managerProxy = null;
232231
this._sessionProxy = null;
232+
this.sessionIsActive = true;
233233

234234
this._initSession();
235235
}
@@ -283,11 +283,9 @@ var LoginManagerConsoleKit = class {
283283
});
284284

285285
this._sessionProxy.connectSignal('ActiveChanged', (proxy, sender, [active]) => {
286+
this.sessionIsActive = active;
286287
_log(`LoginManager: ConsoleKit ActiveChanged: ${active}`);
287-
if (active) {
288-
_log('LoginManager: Session became active, emitting active');
289-
this.emit('active');
290-
}
288+
this.emit('active-changed', active);
291289
});
292290

293291
this.emit('session-ready');

js/ui/screensaver/screenShield.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ var ScreenShield = GObject.registerClass({
188188

189189
this._loginManager.connect('lock', this._onSessionLock.bind(this));
190190
this._loginManager.connect('unlock', this._onSessionUnlock.bind(this));
191-
this._loginManager.connect('active', this._onSessionActive.bind(this));
191+
this._loginManager.connect('active-changed', this._onSessionActiveChanged.bind(this));
192192

193193
this._monitorsChangedId = Main.layoutManager.connect('monitors-changed',
194194
this._onMonitorsChanged.bind(this));
@@ -671,8 +671,10 @@ var ScreenShield = GObject.registerClass({
671671
}
672672
}
673673

674-
_onSessionActive() {
675-
_log(`ScreenShield: Received active signal from LoginManager (state=${this._state})`);
674+
_onSessionActiveChanged(lm, active) {
675+
_log(`ScreenShield: Received active-changed signal from LoginManager (active=${active}, state=${this._state})`);
676+
if (!active)
677+
return;
676678
if (this._state === State.LOCKED) {
677679
this.showUnlockDialog();
678680
}

0 commit comments

Comments
 (0)