File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -38,6 +38,9 @@ const SystemdLoginSessionIface = `
3838 <signal name="Lock"/>
3939 <signal name="Unlock"/>
4040 <property name="Active" type="b" access="read"/>
41+ <method name="SetLockedHint">
42+ <arg type="b" direction="in"/>
43+ </method>
4144 </interface>
4245</node>` ;
4346
@@ -75,6 +78,7 @@ var LoginManagerSystemd = class {
7578 constructor ( ) {
7679 this . _managerProxy = null ;
7780 this . _sessionProxy = null ;
81+ this . isLocked = false ;
7882
7983 this . _initSession ( ) ;
8084 }
@@ -208,6 +212,16 @@ var LoginManagerSystemd = class {
208212 }
209213 } ) ;
210214 }
215+
216+ setLockedHint ( locked ) {
217+ if ( ! this . _sessionProxy )
218+ return ;
219+
220+ this . _sessionProxy . SetLockedHintRemote ( locked , ( result , error ) => {
221+ if ( error )
222+ global . logError ( 'LoginManager: SetLockedHint failed: ' + error ) ;
223+ } ) ;
224+ }
211225} ;
212226Signals . addSignalMethods ( LoginManagerSystemd . prototype ) ;
213227
@@ -291,6 +305,10 @@ var LoginManagerConsoleKit = class {
291305 // ConsoleKit doesn't have inhibitors
292306 callback ( null ) ;
293307 }
308+
309+ setLockedHint ( _locked ) {
310+ // ConsoleKit doesn't have SetLockedHint
311+ }
294312} ;
295313Signals . addSignalMethods ( LoginManagerConsoleKit . prototype ) ;
296314
Original file line number Diff line number Diff line change @@ -371,33 +371,31 @@ var ScreenShield = GObject.registerClass({
371371 this . activate ( immediate , ( success ) => {
372372 if ( success ) {
373373 this . _stopLockDelay ( ) ;
374- this . _setLocked ( true ) ;
374+ this . _setLocked ( ) ;
375375 }
376376 } ) ;
377377 } else {
378378 this . _stopLockDelay ( ) ;
379- this . _setLocked ( true ) ;
379+ this . _setLocked ( ) ;
380380 }
381381 }
382382
383- _setLocked ( locked ) {
384- if ( locked === this . isLocked ( ) )
383+ _setLocked ( ) {
384+ if ( this . isLocked ( ) )
385385 return ;
386386
387- if ( locked ) {
388- this . _dialog . saveSystemLayout ( ) ;
389- this . _setState ( State . LOCKED ) ;
390- this . emit ( 'locked' ) ;
391- } else {
392- this . _setState ( State . SHOWN ) ;
393- }
387+ this . _dialog . saveSystemLayout ( ) ;
388+ this . _setState ( State . LOCKED ) ;
389+ this . _loginManager . setLockedHint ( true ) ;
390+ this . emit ( 'locked' ) ;
394391 }
395392
396393 unlock ( ) {
397394 if ( ! this . isLocked ( ) )
398395 return ;
399396
400397 _log ( 'ScreenShield: Unlocking screen' ) ;
398+ this . _loginManager . setLockedHint ( false ) ;
401399
402400 if ( this . _state === State . UNLOCKING ) {
403401 this . _dialog . hide ( ) ;
@@ -512,7 +510,7 @@ var ScreenShield = GObject.registerClass({
512510 let lockDelay = this . _settings . get_uint ( 'lock-delay' ) ;
513511
514512 if ( lockDelay === 0 ) {
515- this . _setLocked ( true ) ;
513+ this . _setLocked ( ) ;
516514 } else {
517515 this . _lockTimeoutId = GLib . timeout_add_seconds (
518516 GLib . PRIORITY_DEFAULT ,
@@ -531,7 +529,7 @@ var ScreenShield = GObject.registerClass({
531529
532530 _onLockDelayTimeout ( ) {
533531 this . _lockTimeoutId = 0 ;
534- this . _setLocked ( true ) ;
532+ this . _setLocked ( ) ;
535533 return GLib . SOURCE_REMOVE ;
536534 }
537535
You can’t perform that action at this time.
0 commit comments