ScreenLock.st
author Claus Gittinger <cg@exept.de>
Thu, 18 Jan 2018 17:17:40 +0100
changeset 4050 5a4fb030d8fd
parent 4027 274bc7170ace
permissions -rw-r--r--
#DOCUMENTATION by cg class: ApplicationModel comment/format in: #beepInEditor
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
4027
274bc7170ace #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3847
diff changeset
   127
processor
274bc7170ace #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3847
diff changeset
   128
    "return the value of the instance variable 'processor' (automatically generated)"
274bc7170ace #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3847
diff changeset
   129
274bc7170ace #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3847
diff changeset
   130
    ^ processor
274bc7170ace #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3847
diff changeset
   131
!
274bc7170ace #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3847
diff changeset
   132
274bc7170ace #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3847
diff changeset
   133
processor:something
274bc7170ace #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3847
diff changeset
   134
    "set the value of the instance variable 'processor' (automatically generated)"
274bc7170ace #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3847
diff changeset
   135
274bc7170ace #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3847
diff changeset
   136
    processor := something.
274bc7170ace #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3847
diff changeset
   137
!
274bc7170ace #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3847
diff changeset
   138
274bc7170ace #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3847
diff changeset
   139
workstation
274bc7170ace #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3847
diff changeset
   140
    "return the value of the instance variable 'workstation' (automatically generated)"
274bc7170ace #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3847
diff changeset
   141
274bc7170ace #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3847
diff changeset
   142
    ^ workstation
274bc7170ace #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3847
diff changeset
   143
!
274bc7170ace #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3847
diff changeset
   144
274bc7170ace #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3847
diff changeset
   145
workstation:something
274bc7170ace #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3847
diff changeset
   146
    "set the value of the instance variable 'workstation' (automatically generated)"
274bc7170ace #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3847
diff changeset
   147
274bc7170ace #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3847
diff changeset
   148
    workstation := something.
274bc7170ace #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3847
diff changeset
   149
! !
274bc7170ace #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3847
diff changeset
   150
274bc7170ace #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3847
diff changeset
   151
!ScreenLock methodsFor:'accessing-channels'!
274bc7170ace #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3847
diff changeset
   152
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   153
lockChannel
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   154
1416
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   155
    lockChannel isNil ifTrue:[
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   156
        self lockChannel:false asValue.
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   157
    ].
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   158
    ^ lockChannel
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   159
!
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   160
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   161
lockChannel:something
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   162
1416
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   163
    lockChannel notNil ifTrue:[ 
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   164
        lockChannel removeDependent:self.
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   165
    ].
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   166
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   167
    lockChannel := something.
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   168
    lockChannel addDependent:self.
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   169
!
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   170
1415
fd8738cc4733 Use lockChannelOut to avoid races when locking/unlocking
Stefan Vogel <sv@exept.de>
parents: 1376
diff changeset
   171
lockChannelOut
fd8738cc4733 Use lockChannelOut to avoid races when locking/unlocking
Stefan Vogel <sv@exept.de>
parents: 1376
diff changeset
   172
1416
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   173
    lockChannelOut isNil ifTrue:[
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   174
        lockChannelOut := false asValue.
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   175
    ].
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   176
    ^ lockChannelOut
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   177
!
1415
fd8738cc4733 Use lockChannelOut to avoid races when locking/unlocking
Stefan Vogel <sv@exept.de>
parents: 1376
diff changeset
   178
fd8738cc4733 Use lockChannelOut to avoid races when locking/unlocking
Stefan Vogel <sv@exept.de>
parents: 1376
diff changeset
   179
lockChannelOut:something
fd8738cc4733 Use lockChannelOut to avoid races when locking/unlocking
Stefan Vogel <sv@exept.de>
parents: 1376
diff changeset
   180
    "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
   181
1462
b7ffa1109142 Do not restore views that have been closed whlie being invisible.
Stefan Vogel <sv@exept.de>
parents: 1416
diff changeset
   182
    lockChannelOut := something.
b7ffa1109142 Do not restore views that have been closed whlie being invisible.
Stefan Vogel <sv@exept.de>
parents: 1416
diff changeset
   183
! !
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   184
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   185
!ScreenLock methodsFor:'change & update'!
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   186
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   187
update:aspect with:param from:anObject
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   188
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   189
    |lock|
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   190
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   191
    anObject == lockChannel ifTrue:[
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   192
        aspect == #value ifTrue:[
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   193
            "/ lockChannel is a value holder
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   194
            lock := lockChannel value.
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   195
        ] ifFalse:[
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   196
            "/ lockChannel is a block or something else
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   197
            lock := param.
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   198
        ].
1416
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   199
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   200
        "lock or unlock the screen
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   201
         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
   202
         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
   203
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   204
        lock == true ifTrue:[
1416
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   205
            processor isNil ifTrue:[
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   206
                self lockScreen.
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   207
            ] ifFalse:[
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   208
                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
   209
            ].
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   210
        ] ifFalse:[
1416
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   211
            processor isNil ifTrue:[
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   212
                self unlockScreen.
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   213
            ] ifFalse:[
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   214
                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
   215
            ].
1371
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
! !
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   219
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   220
!ScreenLock methodsFor:'events'!
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   221
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   222
buttonMotion:state x:x y:y view:aView
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   223
1374
881f1ba7ca1e Eat all user generated events if locked.
Stefan Vogel <sv@exept.de>
parents: 1371
diff changeset
   224
    ^ self gotEventForView:aView.
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   225
!
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   226
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   227
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
   228
    ^ self gotEventForView:aView.
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   229
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   230
!
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   231
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   232
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
   233
    ^ self gotEventForView:aView.
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   234
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   235
!
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   236
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   237
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
   238
    ^ self gotEventForView:aView.
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   239
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   240
!
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   241
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   242
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
   243
    ^ self gotEventForView:aView.
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   244
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   245
!
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   246
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   247
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
   248
    ^ self gotEventForView:aView.
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   249
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   250
!
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   251
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   252
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
   253
    ^ self gotEventForView:aView.
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   254
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   255
! !
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   256
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   257
!ScreenLock methodsFor:'lock interface'!
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   258
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   259
checkTime
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   260
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   261
    |now|
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   262
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   263
    lockedViews isNil ifTrue:[
1966
b82e1cebf7af Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 1462
diff changeset
   264
        now := Timestamp now.
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   265
        lastInactiveTime notNil ifTrue:[
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   266
            (lastInactiveTime addSeconds:lockAfterSeconds value) < now ifTrue:[
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   267
                self lock
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   268
            ].
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   269
        ] ifFalse:[
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   270
            lastInactiveTime := now.
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
!
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   274
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   275
lock
1416
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   276
   "trigger locking of screen"
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   277
1416
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   278
    self lockChannel value:true.
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   279
!
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   280
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   281
unlisten
1416
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   282
    "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
   283
     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
   284
     screen."
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   285
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   286
    workstation removeEventListener:self
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   287
!
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   288
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   289
unlock
1416
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   290
   "trigger unlocking of screen"
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   291
1416
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   292
    self lockChannel value:false.
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   293
! !
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   294
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   295
!ScreenLock methodsFor:'private'!
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   296
1374
881f1ba7ca1e Eat all user generated events if locked.
Stefan Vogel <sv@exept.de>
parents: 1371
diff changeset
   297
gotEventForView:v
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   298
    "got an event.
1374
881f1ba7ca1e Eat all user generated events if locked.
Stefan Vogel <sv@exept.de>
parents: 1371
diff changeset
   299
     Reset the inactive timer.
881f1ba7ca1e Eat all user generated events if locked.
Stefan Vogel <sv@exept.de>
parents: 1371
diff changeset
   300
     If locked, eat all user events (for security)"
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   301
1376
6294517bece4 Keep date of start of inactivity.
Stefan Vogel <sv@exept.de>
parents: 1374
diff changeset
   302
    lockedViews isNil ifTrue:[
6294517bece4 Keep date of start of inactivity.
Stefan Vogel <sv@exept.de>
parents: 1374
diff changeset
   303
        lastInactiveTime := nil.        
6294517bece4 Keep date of start of inactivity.
Stefan Vogel <sv@exept.de>
parents: 1374
diff changeset
   304
        ^ false.
6294517bece4 Keep date of start of inactivity.
Stefan Vogel <sv@exept.de>
parents: 1374
diff changeset
   305
    ].
6294517bece4 Keep date of start of inactivity.
Stefan Vogel <sv@exept.de>
parents: 1374
diff changeset
   306
    ^ lockedViews includes:v.
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   307
!
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   308
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   309
initializeForDevice:aWorkstation
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   310
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   311
     lockAfterSeconds := 10.
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   312
     workstation := aWorkstation.
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   313
     workstation addEventListener:self.
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   314
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   315
!
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   316
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   317
lockScreen
1416
79f3aee2d64c Add processor (an ApplicationModel), which processes the lock/unlock
Stefan Vogel <sv@exept.de>
parents: 1415
diff changeset
   318
    "lock the screen"
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   319
1374
881f1ba7ca1e Eat all user generated events if locked.
Stefan Vogel <sv@exept.de>
parents: 1371
diff changeset
   320
    lockedViews := workstation allViews.
1376
6294517bece4 Keep date of start of inactivity.
Stefan Vogel <sv@exept.de>
parents: 1374
diff changeset
   321
    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
   322
        "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
   323
         they are unmapped.
b7ffa1109142 Do not restore views that have been closed whlie being invisible.
Stefan Vogel <sv@exept.de>
parents: 1416
diff changeset
   324
         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
   325
         currently not supported"
b7ffa1109142 Do not restore views that have been closed whlie being invisible.
Stefan Vogel <sv@exept.de>
parents: 1416
diff changeset
   326
b7ffa1109142 Do not restore views that have been closed whlie being invisible.
Stefan Vogel <sv@exept.de>
parents: 1416
diff changeset
   327
        v isPopUpView ifTrue:[
b7ffa1109142 Do not restore views that have been closed whlie being invisible.
Stefan Vogel <sv@exept.de>
parents: 1416
diff changeset
   328
            v hide.
1376
6294517bece4 Keep date of start of inactivity.
Stefan Vogel <sv@exept.de>
parents: 1374
diff changeset
   329
        ].
1462
b7ffa1109142 Do not restore views that have been closed whlie being invisible.
Stefan Vogel <sv@exept.de>
parents: 1416
diff changeset
   330
        v shown and:[v isTopView].
1376
6294517bece4 Keep date of start of inactivity.
Stefan Vogel <sv@exept.de>
parents: 1374
diff changeset
   331
    ].
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   332
1374
881f1ba7ca1e Eat all user generated events if locked.
Stefan Vogel <sv@exept.de>
parents: 1371
diff changeset
   333
    hiddenViews do:[:v|
881f1ba7ca1e Eat all user generated events if locked.
Stefan Vogel <sv@exept.de>
parents: 1371
diff changeset
   334
        v beInvisible.
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   335
    ].
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   336
1415
fd8738cc4733 Use lockChannelOut to avoid races when locking/unlocking
Stefan Vogel <sv@exept.de>
parents: 1376
diff changeset
   337
    lockChannelOut notNil ifTrue:[      
fd8738cc4733 Use lockChannelOut to avoid races when locking/unlocking
Stefan Vogel <sv@exept.de>
parents: 1376
diff changeset
   338
        lockChannelOut value:true.
fd8738cc4733 Use lockChannelOut to avoid races when locking/unlocking
Stefan Vogel <sv@exept.de>
parents: 1376
diff changeset
   339
    ].
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   340
!
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   341
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   342
unlockScreen
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   343
1376
6294517bece4 Keep date of start of inactivity.
Stefan Vogel <sv@exept.de>
parents: 1374
diff changeset
   344
    lastInactiveTime := nil.
6294517bece4 Keep date of start of inactivity.
Stefan Vogel <sv@exept.de>
parents: 1374
diff changeset
   345
    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
   346
        "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
   347
         being invisible"
b7ffa1109142 Do not restore views that have been closed whlie being invisible.
Stefan Vogel <sv@exept.de>
parents: 1416
diff changeset
   348
        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
   349
            v beVisible.
b7ffa1109142 Do not restore views that have been closed whlie being invisible.
Stefan Vogel <sv@exept.de>
parents: 1416
diff changeset
   350
        ].
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   351
    ].
1374
881f1ba7ca1e Eat all user generated events if locked.
Stefan Vogel <sv@exept.de>
parents: 1371
diff changeset
   352
    hiddenViews := lockedViews := nil.
1415
fd8738cc4733 Use lockChannelOut to avoid races when locking/unlocking
Stefan Vogel <sv@exept.de>
parents: 1376
diff changeset
   353
fd8738cc4733 Use lockChannelOut to avoid races when locking/unlocking
Stefan Vogel <sv@exept.de>
parents: 1376
diff changeset
   354
    lockChannelOut notNil ifTrue:[      
fd8738cc4733 Use lockChannelOut to avoid races when locking/unlocking
Stefan Vogel <sv@exept.de>
parents: 1376
diff changeset
   355
        lockChannelOut value:false.
fd8738cc4733 Use lockChannelOut to avoid races when locking/unlocking
Stefan Vogel <sv@exept.de>
parents: 1376
diff changeset
   356
    ].
1374
881f1ba7ca1e Eat all user generated events if locked.
Stefan Vogel <sv@exept.de>
parents: 1371
diff changeset
   357
! !
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
!ScreenLock methodsFor:'queries'!
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
isLocked
881f1ba7ca1e Eat all user generated events if locked.
Stefan Vogel <sv@exept.de>
parents: 1371
diff changeset
   362
881f1ba7ca1e Eat all user generated events if locked.
Stefan Vogel <sv@exept.de>
parents: 1371
diff changeset
   363
    ^ lockedViews notNil
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   364
! !
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   365
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   366
!ScreenLock class methodsFor:'documentation'!
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   367
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   368
version
3847
ac2486ce7d6f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   369
    ^ '$Header$'
1371
a022e5804f07 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   370
! !
3847
ac2486ce7d6f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   371