ScreenLock.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Wed, 30 May 2018 09:37:07 +0100
branchjv
changeset 4132 7e5528572373
parent 3872 1bb887d32316
permissions -rw-r--r--
Copyright updates
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3847
ac2486ce7d6f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
     1
"
ac2486ce7d6f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
     2
 COPYRIGHT (c) 2000 by eXept Software AG
ac2486ce7d6f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
     3
              All Rights Reserved
ac2486ce7d6f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
     4
ac2486ce7d6f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
     5
 This software is furnished under a license and may be used
ac2486ce7d6f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
     6
 only in accordance with the terms of that license and with the
ac2486ce7d6f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
ac2486ce7d6f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
     8
 be provided or otherwise made available to, or used by, any
ac2486ce7d6f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
     9
 other person.  No title to or ownership of the software is
ac2486ce7d6f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
    10
 hereby transferred.
ac2486ce7d6f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
    11
"
1374
881f1ba7ca1e Eat all user generated events if locked.
Stefan Vogel <sv@exept.de>
parents: 1371
diff changeset
    12
"{ Package: 'stx:libview2' }"
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    13
3847
ac2486ce7d6f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
    14
"{ NameSpace: Smalltalk }"
ac2486ce7d6f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
    15
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    16
EventListener subclass:#ScreenLock
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    17
	instanceVariableNames:'workstation lastInactiveTime lockAfterSeconds lockChannel
1416
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
    18
		lockChannelOut processor lockedViews hiddenViews'
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    19
	classVariableNames:''
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    20
	poolDictionaries:''
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    21
	category:'Interface-Support'
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    22
!
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    23
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    24
!ScreenLock class methodsFor:'documentation'!
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    25
3847
ac2486ce7d6f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
    26
copyright
ac2486ce7d6f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
    27
"
ac2486ce7d6f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
    28
 COPYRIGHT (c) 2000 by eXept Software AG
ac2486ce7d6f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
    29
              All Rights Reserved
ac2486ce7d6f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
    30
ac2486ce7d6f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
    31
 This software is furnished under a license and may be used
ac2486ce7d6f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
    32
 only in accordance with the terms of that license and with the
ac2486ce7d6f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
    33
 inclusion of the above copyright notice.   This software may not
ac2486ce7d6f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
    34
 be provided or otherwise made available to, or used by, any
ac2486ce7d6f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
    35
 other person.  No title to or ownership of the software is
ac2486ce7d6f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
    36
 hereby transferred.
ac2486ce7d6f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
    37
"
ac2486ce7d6f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
    38
!
ac2486ce7d6f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
    39
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    40
documentation
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    41
"
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    42
    documentation to be added.
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    43
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    44
    [author:]
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    45
	Stefan Vogel (stefan@nilpferd)
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    46
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    47
    [see also:]
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    48
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    49
    [instance variables:]
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    50
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    51
    [class variables:]
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    52
"
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    53
!
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    54
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    55
examples
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    56
"
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    57
                                                                [exBegin]
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    58
    |screenLock|
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    59
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    60
    screenLock := ScreenLock forDevice:Screen current.
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    61
    screenLock lock.
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    62
    Delay waitForSeconds:3.
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    63
    screenLock unlock.
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    64
    screenLock unlisten.
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    65
                                                                [exEnd]
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    66
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    67
                                                                [exBegin]
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    68
    |screenLock|
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    69
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    70
    screenLock := ScreenLock forDevice:Screen current.
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    71
    Delay waitForSeconds:1.
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    72
    screenLock checkTime.
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    73
    Delay waitForSeconds:12.
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    74
    screenLock checkTime.
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    75
    Delay waitForSeconds:3.
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    76
    screenLock unlock.
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    77
    screenLock unlisten.
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    78
                                                                [exEnd]
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    79
                                                                [exBegin]
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    80
    |screenLock channel running|
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    81
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    82
    screenLock := ScreenLock forDevice:Screen current.
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    83
    screenLock lockAfterSeconds:4.
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    84
    [
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    85
        channel := false asValue.
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    86
        channel onChangeEvaluate:[
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    87
            channel value ifTrue:[
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    88
                self information:'Application is locked\\Hit ok to unlock' withCRs.
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    89
                channel value:false.
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    90
            ].
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    91
        ].
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    92
        screenLock lockChannel:channel.
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    93
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    94
        [
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    95
            Delay waitForSeconds:2.
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    96
            screenLock checkTime.
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    97
        ] loop.
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    98
    ] valueNowOrOnUnwindDo:[
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    99
        screenLock unlisten.
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   100
    ].
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   101
                                                                [exEnd]
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   102
"
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   103
! !
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   104
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   105
!ScreenLock class methodsFor:'instance creation'!
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   106
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   107
forDevice:aWorkstation
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   108
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   109
    ^ self new initializeForDevice:aWorkstation
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   110
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   111
! !
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   112
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   113
!ScreenLock methodsFor:'accessing'!
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   114
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   115
lockAfterSeconds
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   116
    "return the value of the instance variable 'lockAfterSeconds' (automatically generated)"
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   117
1462
b7ffa1109142 Do not restore views that have been closed whlie being invisible.
Stefan Vogel <sv@exept.de>
parents: 1416
diff changeset
   118
    ^ lockAfterSeconds
b7ffa1109142 Do not restore views that have been closed whlie being invisible.
Stefan Vogel <sv@exept.de>
parents: 1416
diff changeset
   119
!
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   120
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   121
lockAfterSeconds:something
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   122
    "set the value of the instance variable 'lockAfterSeconds' (automatically generated)"
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   123
1462
b7ffa1109142 Do not restore views that have been closed whlie being invisible.
Stefan Vogel <sv@exept.de>
parents: 1416
diff changeset
   124
    lockAfterSeconds := something.
b7ffa1109142 Do not restore views that have been closed whlie being invisible.
Stefan Vogel <sv@exept.de>
parents: 1416
diff changeset
   125
!
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   126
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   127
lockChannel
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   128
1416
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   129
    lockChannel isNil ifTrue:[
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   130
        self lockChannel:false asValue.
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   131
    ].
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   132
    ^ lockChannel
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   133
!
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   134
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   135
lockChannel:something
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   136
1416
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   137
    lockChannel notNil ifTrue:[ 
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   138
        lockChannel removeDependent:self.
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   139
    ].
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   140
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   141
    lockChannel := something.
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   142
    lockChannel addDependent:self.
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   143
!
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   144
1415
fd8738cc4733 Use lockChannelOut to avoid races when locking/unlocking
Stefan Vogel <sv@exept.de>
parents: 1376
diff changeset
   145
lockChannelOut
fd8738cc4733 Use lockChannelOut to avoid races when locking/unlocking
Stefan Vogel <sv@exept.de>
parents: 1376
diff changeset
   146
1416
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   147
    lockChannelOut isNil ifTrue:[
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   148
        lockChannelOut := false asValue.
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   149
    ].
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   150
    ^ lockChannelOut
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   151
!
1415
fd8738cc4733 Use lockChannelOut to avoid races when locking/unlocking
Stefan Vogel <sv@exept.de>
parents: 1376
diff changeset
   152
fd8738cc4733 Use lockChannelOut to avoid races when locking/unlocking
Stefan Vogel <sv@exept.de>
parents: 1376
diff changeset
   153
lockChannelOut:something
fd8738cc4733 Use lockChannelOut to avoid races when locking/unlocking
Stefan Vogel <sv@exept.de>
parents: 1376
diff changeset
   154
    "set the value of the instance variable 'lockChannelOut' (automatically generated)"
fd8738cc4733 Use lockChannelOut to avoid races when locking/unlocking
Stefan Vogel <sv@exept.de>
parents: 1376
diff changeset
   155
1462
b7ffa1109142 Do not restore views that have been closed whlie being invisible.
Stefan Vogel <sv@exept.de>
parents: 1416
diff changeset
   156
    lockChannelOut := something.
b7ffa1109142 Do not restore views that have been closed whlie being invisible.
Stefan Vogel <sv@exept.de>
parents: 1416
diff changeset
   157
!
1415
fd8738cc4733 Use lockChannelOut to avoid races when locking/unlocking
Stefan Vogel <sv@exept.de>
parents: 1376
diff changeset
   158
1416
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   159
processor
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   160
    "return the value of the instance variable 'processor' (automatically generated)"
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   161
1462
b7ffa1109142 Do not restore views that have been closed whlie being invisible.
Stefan Vogel <sv@exept.de>
parents: 1416
diff changeset
   162
    ^ processor
b7ffa1109142 Do not restore views that have been closed whlie being invisible.
Stefan Vogel <sv@exept.de>
parents: 1416
diff changeset
   163
!
1416
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   164
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   165
processor:something
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   166
    "set the value of the instance variable 'processor' (automatically generated)"
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   167
1462
b7ffa1109142 Do not restore views that have been closed whlie being invisible.
Stefan Vogel <sv@exept.de>
parents: 1416
diff changeset
   168
    processor := something.
b7ffa1109142 Do not restore views that have been closed whlie being invisible.
Stefan Vogel <sv@exept.de>
parents: 1416
diff changeset
   169
!
1416
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   170
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   171
workstation
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   172
    "return the value of the instance variable 'workstation' (automatically generated)"
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   173
1462
b7ffa1109142 Do not restore views that have been closed whlie being invisible.
Stefan Vogel <sv@exept.de>
parents: 1416
diff changeset
   174
    ^ workstation
b7ffa1109142 Do not restore views that have been closed whlie being invisible.
Stefan Vogel <sv@exept.de>
parents: 1416
diff changeset
   175
!
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   176
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   177
workstation:something
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   178
    "set the value of the instance variable 'workstation' (automatically generated)"
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   179
1462
b7ffa1109142 Do not restore views that have been closed whlie being invisible.
Stefan Vogel <sv@exept.de>
parents: 1416
diff changeset
   180
    workstation := something.
b7ffa1109142 Do not restore views that have been closed whlie being invisible.
Stefan Vogel <sv@exept.de>
parents: 1416
diff changeset
   181
! !
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   182
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   183
!ScreenLock methodsFor:'change & update'!
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   184
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   185
update:aspect with:param from:anObject
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   186
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   187
    |lock|
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   188
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   189
    anObject == lockChannel ifTrue:[
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   190
        aspect == #value ifTrue:[
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   191
            "/ lockChannel is a value holder
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   192
            lock := lockChannel value.
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   193
        ] ifFalse:[
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   194
            "/ lockChannel is a block or something else
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   195
            lock := param.
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   196
        ].
1416
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   197
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   198
        "lock or unlock the screen
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   199
         If a processor is defined, let the processor perform the unlock,
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   200
         so that posssible Display errors do not affect the sender"
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   201
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   202
        lock == true ifTrue:[
1416
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   203
            processor isNil ifTrue:[
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   204
                self lockScreen.
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   205
            ] ifFalse:[
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   206
                processor enqueueMessage:#lockScreen for:self arguments:#().
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   207
            ].
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   208
        ] ifFalse:[
1416
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   209
            processor isNil ifTrue:[
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   210
                self unlockScreen.
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   211
            ] ifFalse:[
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   212
                processor enqueueMessage:#unlockScreen for:self arguments:#().
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   213
            ].
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   214
        ]
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   215
    ].
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   216
! !
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   217
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   218
!ScreenLock methodsFor:'events'!
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   219
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   220
buttonMotion:state x:x y:y view:aView
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   221
1374
881f1ba7ca1e Eat all user generated events if locked.
Stefan Vogel <sv@exept.de>
parents: 1371
diff changeset
   222
    ^ self gotEventForView:aView.
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   223
!
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   224
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   225
buttonMultiPress:button x:x y:y view:aView
1374
881f1ba7ca1e Eat all user generated events if locked.
Stefan Vogel <sv@exept.de>
parents: 1371
diff changeset
   226
    ^ self gotEventForView:aView.
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   227
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   228
!
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   229
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   230
buttonPress:button x:x y:y view:aView
1374
881f1ba7ca1e Eat all user generated events if locked.
Stefan Vogel <sv@exept.de>
parents: 1371
diff changeset
   231
    ^ self gotEventForView:aView.
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   232
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   233
!
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   234
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   235
buttonRelease:button x:x y:y view:aView
1374
881f1ba7ca1e Eat all user generated events if locked.
Stefan Vogel <sv@exept.de>
parents: 1371
diff changeset
   236
    ^ self gotEventForView:aView.
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   237
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   238
!
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   239
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   240
keyPress:key x:x y:y view:aView
1374
881f1ba7ca1e Eat all user generated events if locked.
Stefan Vogel <sv@exept.de>
parents: 1371
diff changeset
   241
    ^ self gotEventForView:aView.
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   242
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   243
!
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   244
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   245
keyRelease:key x:x y:y view:aView
1374
881f1ba7ca1e Eat all user generated events if locked.
Stefan Vogel <sv@exept.de>
parents: 1371
diff changeset
   246
    ^ self gotEventForView:aView.
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   247
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   248
!
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   249
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   250
mouseWheelMotion:state x:x y:y amount:amount deltaTime:dTime view:aView
1374
881f1ba7ca1e Eat all user generated events if locked.
Stefan Vogel <sv@exept.de>
parents: 1371
diff changeset
   251
    ^ self gotEventForView:aView.
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   252
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   253
! !
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   254
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   255
!ScreenLock methodsFor:'lock interface'!
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   256
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   257
checkTime
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   258
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   259
    |now|
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   260
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   261
    lockedViews isNil ifTrue:[
1966
b82e1cebf7af Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 1462
diff changeset
   262
        now := Timestamp now.
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   263
        lastInactiveTime notNil ifTrue:[
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   264
            (lastInactiveTime addSeconds:lockAfterSeconds value) < now ifTrue:[
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   265
                self lock
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   266
            ].
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   267
        ] ifFalse:[
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   268
            lastInactiveTime := now.
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   269
        ].
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   270
    ].
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   271
!
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   272
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   273
lock
1416
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   274
   "trigger locking of screen"
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   275
1416
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   276
    self lockChannel value:true.
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   277
!
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   278
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   279
unlisten
1416
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   280
    "do not listen for events any longer.
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   281
     This must be called when a screen lock is detached from a
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   282
     screen."
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   283
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   284
    workstation removeEventListener:self
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   285
!
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   286
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   287
unlock
1416
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   288
   "trigger unlocking of screen"
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   289
1416
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   290
    self lockChannel value:false.
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   291
! !
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   292
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   293
!ScreenLock methodsFor:'private'!
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   294
1374
881f1ba7ca1e Eat all user generated events if locked.
Stefan Vogel <sv@exept.de>
parents: 1371
diff changeset
   295
gotEventForView:v
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   296
    "got an event.
1374
881f1ba7ca1e Eat all user generated events if locked.
Stefan Vogel <sv@exept.de>
parents: 1371
diff changeset
   297
     Reset the inactive timer.
881f1ba7ca1e Eat all user generated events if locked.
Stefan Vogel <sv@exept.de>
parents: 1371
diff changeset
   298
     If locked, eat all user events (for security)"
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   299
1376
6294517bece4 Keep date of start of inactivity.
Stefan Vogel <sv@exept.de>
parents: 1374
diff changeset
   300
    lockedViews isNil ifTrue:[
6294517bece4 Keep date of start of inactivity.
Stefan Vogel <sv@exept.de>
parents: 1374
diff changeset
   301
        lastInactiveTime := nil.        
6294517bece4 Keep date of start of inactivity.
Stefan Vogel <sv@exept.de>
parents: 1374
diff changeset
   302
        ^ false.
6294517bece4 Keep date of start of inactivity.
Stefan Vogel <sv@exept.de>
parents: 1374
diff changeset
   303
    ].
6294517bece4 Keep date of start of inactivity.
Stefan Vogel <sv@exept.de>
parents: 1374
diff changeset
   304
    ^ lockedViews includes:v.
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   305
!
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   306
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   307
initializeForDevice:aWorkstation
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   308
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   309
     lockAfterSeconds := 10.
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   310
     workstation := aWorkstation.
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   311
     workstation addEventListener:self.
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   312
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   313
!
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   314
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   315
lockScreen
1416
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   316
    "lock the screen"
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   317
1374
881f1ba7ca1e Eat all user generated events if locked.
Stefan Vogel <sv@exept.de>
parents: 1371
diff changeset
   318
    lockedViews := workstation allViews.
1376
6294517bece4 Keep date of start of inactivity.
Stefan Vogel <sv@exept.de>
parents: 1374
diff changeset
   319
    hiddenViews := lockedViews select:[:v|
1462
b7ffa1109142 Do not restore views that have been closed whlie being invisible.
Stefan Vogel <sv@exept.de>
parents: 1416
diff changeset
   320
        "close popupViews, they will leave the modal loop when 
b7ffa1109142 Do not restore views that have been closed whlie being invisible.
Stefan Vogel <sv@exept.de>
parents: 1416
diff changeset
   321
         they are unmapped.
b7ffa1109142 Do not restore views that have been closed whlie being invisible.
Stefan Vogel <sv@exept.de>
parents: 1416
diff changeset
   322
         This is a kludge, but invisible popUpViews are 
b7ffa1109142 Do not restore views that have been closed whlie being invisible.
Stefan Vogel <sv@exept.de>
parents: 1416
diff changeset
   323
         currently not supported"
b7ffa1109142 Do not restore views that have been closed whlie being invisible.
Stefan Vogel <sv@exept.de>
parents: 1416
diff changeset
   324
b7ffa1109142 Do not restore views that have been closed whlie being invisible.
Stefan Vogel <sv@exept.de>
parents: 1416
diff changeset
   325
        v isPopUpView ifTrue:[
b7ffa1109142 Do not restore views that have been closed whlie being invisible.
Stefan Vogel <sv@exept.de>
parents: 1416
diff changeset
   326
            v hide.
1376
6294517bece4 Keep date of start of inactivity.
Stefan Vogel <sv@exept.de>
parents: 1374
diff changeset
   327
        ].
1462
b7ffa1109142 Do not restore views that have been closed whlie being invisible.
Stefan Vogel <sv@exept.de>
parents: 1416
diff changeset
   328
        v shown and:[v isTopView].
1376
6294517bece4 Keep date of start of inactivity.
Stefan Vogel <sv@exept.de>
parents: 1374
diff changeset
   329
    ].
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   330
1374
881f1ba7ca1e Eat all user generated events if locked.
Stefan Vogel <sv@exept.de>
parents: 1371
diff changeset
   331
    hiddenViews do:[:v|
881f1ba7ca1e Eat all user generated events if locked.
Stefan Vogel <sv@exept.de>
parents: 1371
diff changeset
   332
        v beInvisible.
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   333
    ].
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   334
1415
fd8738cc4733 Use lockChannelOut to avoid races when locking/unlocking
Stefan Vogel <sv@exept.de>
parents: 1376
diff changeset
   335
    lockChannelOut notNil ifTrue:[      
fd8738cc4733 Use lockChannelOut to avoid races when locking/unlocking
Stefan Vogel <sv@exept.de>
parents: 1376
diff changeset
   336
        lockChannelOut value:true.
fd8738cc4733 Use lockChannelOut to avoid races when locking/unlocking
Stefan Vogel <sv@exept.de>
parents: 1376
diff changeset
   337
    ].
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   338
!
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   339
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   340
unlockScreen
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   341
1376
6294517bece4 Keep date of start of inactivity.
Stefan Vogel <sv@exept.de>
parents: 1374
diff changeset
   342
    lastInactiveTime := nil.
6294517bece4 Keep date of start of inactivity.
Stefan Vogel <sv@exept.de>
parents: 1374
diff changeset
   343
    hiddenViews do:[:v|
1462
b7ffa1109142 Do not restore views that have been closed whlie being invisible.
Stefan Vogel <sv@exept.de>
parents: 1416
diff changeset
   344
        "don't try to restore views that have been closed while
b7ffa1109142 Do not restore views that have been closed whlie being invisible.
Stefan Vogel <sv@exept.de>
parents: 1416
diff changeset
   345
         being invisible"
b7ffa1109142 Do not restore views that have been closed whlie being invisible.
Stefan Vogel <sv@exept.de>
parents: 1416
diff changeset
   346
        v id notNil ifTrue:[
b7ffa1109142 Do not restore views that have been closed whlie being invisible.
Stefan Vogel <sv@exept.de>
parents: 1416
diff changeset
   347
            v beVisible.
b7ffa1109142 Do not restore views that have been closed whlie being invisible.
Stefan Vogel <sv@exept.de>
parents: 1416
diff changeset
   348
        ].
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   349
    ].
1374
881f1ba7ca1e Eat all user generated events if locked.
Stefan Vogel <sv@exept.de>
parents: 1371
diff changeset
   350
    hiddenViews := lockedViews := nil.
1415
fd8738cc4733 Use lockChannelOut to avoid races when locking/unlocking
Stefan Vogel <sv@exept.de>
parents: 1376
diff changeset
   351
fd8738cc4733 Use lockChannelOut to avoid races when locking/unlocking
Stefan Vogel <sv@exept.de>
parents: 1376
diff changeset
   352
    lockChannelOut notNil ifTrue:[      
fd8738cc4733 Use lockChannelOut to avoid races when locking/unlocking
Stefan Vogel <sv@exept.de>
parents: 1376
diff changeset
   353
        lockChannelOut value:false.
fd8738cc4733 Use lockChannelOut to avoid races when locking/unlocking
Stefan Vogel <sv@exept.de>
parents: 1376
diff changeset
   354
    ].
1374
881f1ba7ca1e Eat all user generated events if locked.
Stefan Vogel <sv@exept.de>
parents: 1371
diff changeset
   355
! !
881f1ba7ca1e Eat all user generated events if locked.
Stefan Vogel <sv@exept.de>
parents: 1371
diff changeset
   356
881f1ba7ca1e Eat all user generated events if locked.
Stefan Vogel <sv@exept.de>
parents: 1371
diff changeset
   357
!ScreenLock methodsFor:'queries'!
881f1ba7ca1e Eat all user generated events if locked.
Stefan Vogel <sv@exept.de>
parents: 1371
diff changeset
   358
881f1ba7ca1e Eat all user generated events if locked.
Stefan Vogel <sv@exept.de>
parents: 1371
diff changeset
   359
isLocked
881f1ba7ca1e Eat all user generated events if locked.
Stefan Vogel <sv@exept.de>
parents: 1371
diff changeset
   360
881f1ba7ca1e Eat all user generated events if locked.
Stefan Vogel <sv@exept.de>
parents: 1371
diff changeset
   361
    ^ lockedViews notNil
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   362
! !
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   363
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   364
!ScreenLock class methodsFor:'documentation'!
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   365
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   366
version
3847
ac2486ce7d6f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   367
    ^ '$Header$'
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   368
! !
3847
ac2486ce7d6f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   369