author | convert-repo |
Sat, 11 Feb 2017 04:41:47 +0000 | |
changeset 3880 | c4269847c0fe |
parent 3847 | ac2486ce7d6f |
child 3872 | 1bb887d32316 |
child 4027 | 274bc7170ace |
permissions | -rw-r--r-- |
3847 | 1 |
" |
2 |
COPYRIGHT (c) 2000 by eXept Software AG |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
1374
881f1ba7ca1e
Eat all user generated events if locked.
Stefan Vogel <sv@exept.de>
parents:
1371
diff
changeset
|
12 |
"{ Package: 'stx:libview2' }" |
1371 | 13 |
|
3847 | 14 |
"{ NameSpace: Smalltalk }" |
15 |
||
1371 | 16 |
EventListener subclass:#ScreenLock |
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 | 19 |
classVariableNames:'' |
20 |
poolDictionaries:'' |
|
21 |
category:'Interface-Support' |
|
22 |
! |
|
23 |
||
24 |
!ScreenLock class methodsFor:'documentation'! |
|
25 |
||
3847 | 26 |
copyright |
27 |
" |
|
28 |
COPYRIGHT (c) 2000 by eXept Software AG |
|
29 |
All Rights Reserved |
|
30 |
||
31 |
This software is furnished under a license and may be used |
|
32 |
only in accordance with the terms of that license and with the |
|
33 |
inclusion of the above copyright notice. This software may not |
|
34 |
be provided or otherwise made available to, or used by, any |
|
35 |
other person. No title to or ownership of the software is |
|
36 |
hereby transferred. |
|
37 |
" |
|
38 |
! |
|
39 |
||
1371 | 40 |
documentation |
41 |
" |
|
42 |
documentation to be added. |
|
43 |
||
44 |
[author:] |
|
45 |
Stefan Vogel (stefan@nilpferd) |
|
46 |
||
47 |
[see also:] |
|
48 |
||
49 |
[instance variables:] |
|
50 |
||
51 |
[class variables:] |
|
52 |
" |
|
53 |
! |
|
54 |
||
55 |
examples |
|
56 |
" |
|
57 |
[exBegin] |
|
58 |
|screenLock| |
|
59 |
||
60 |
screenLock := ScreenLock forDevice:Screen current. |
|
61 |
screenLock lock. |
|
62 |
Delay waitForSeconds:3. |
|
63 |
screenLock unlock. |
|
64 |
screenLock unlisten. |
|
65 |
[exEnd] |
|
66 |
||
67 |
[exBegin] |
|
68 |
|screenLock| |
|
69 |
||
70 |
screenLock := ScreenLock forDevice:Screen current. |
|
71 |
Delay waitForSeconds:1. |
|
72 |
screenLock checkTime. |
|
73 |
Delay waitForSeconds:12. |
|
74 |
screenLock checkTime. |
|
75 |
Delay waitForSeconds:3. |
|
76 |
screenLock unlock. |
|
77 |
screenLock unlisten. |
|
78 |
[exEnd] |
|
79 |
[exBegin] |
|
80 |
|screenLock channel running| |
|
81 |
||
82 |
screenLock := ScreenLock forDevice:Screen current. |
|
83 |
screenLock lockAfterSeconds:4. |
|
84 |
[ |
|
85 |
channel := false asValue. |
|
86 |
channel onChangeEvaluate:[ |
|
87 |
channel value ifTrue:[ |
|
88 |
self information:'Application is locked\\Hit ok to unlock' withCRs. |
|
89 |
channel value:false. |
|
90 |
]. |
|
91 |
]. |
|
92 |
screenLock lockChannel:channel. |
|
93 |
||
94 |
[ |
|
95 |
Delay waitForSeconds:2. |
|
96 |
screenLock checkTime. |
|
97 |
] loop. |
|
98 |
] valueNowOrOnUnwindDo:[ |
|
99 |
screenLock unlisten. |
|
100 |
]. |
|
101 |
[exEnd] |
|
102 |
" |
|
103 |
! ! |
|
104 |
||
105 |
!ScreenLock class methodsFor:'instance creation'! |
|
106 |
||
107 |
forDevice:aWorkstation |
|
108 |
||
109 |
^ self new initializeForDevice:aWorkstation |
|
110 |
||
111 |
! ! |
|
112 |
||
113 |
!ScreenLock methodsFor:'accessing'! |
|
114 |
||
115 |
lockAfterSeconds |
|
116 |
"return the value of the instance variable 'lockAfterSeconds' (automatically generated)" |
|
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 | 120 |
|
121 |
lockAfterSeconds:something |
|
122 |
"set the value of the instance variable 'lockAfterSeconds' (automatically generated)" |
|
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 | 126 |
|
127 |
lockChannel |
|
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 | 134 |
|
135 |
lockChannel:something |
|
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 | 141 |
lockChannel := something. |
142 |
lockChannel addDependent:self. |
|
143 |
! |
|
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 | 171 |
workstation |
172 |
"return the value of the instance variable 'workstation' (automatically generated)" |
|
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 | 176 |
|
177 |
workstation:something |
|
178 |
"set the value of the instance variable 'workstation' (automatically generated)" |
|
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 | 182 |
|
183 |
!ScreenLock methodsFor:'change & update'! |
|
184 |
||
185 |
update:aspect with:param from:anObject |
|
186 |
||
187 |
|lock| |
|
188 |
||
189 |
anObject == lockChannel ifTrue:[ |
|
190 |
aspect == #value ifTrue:[ |
|
191 |
"/ lockChannel is a value holder |
|
192 |
lock := lockChannel value. |
|
193 |
] ifFalse:[ |
|
194 |
"/ lockChannel is a block or something else |
|
195 |
lock := param. |
|
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 | 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 | 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 | 214 |
] |
215 |
]. |
|
216 |
! ! |
|
217 |
||
218 |
!ScreenLock methodsFor:'events'! |
|
219 |
||
220 |
buttonMotion:state x:x y:y view:aView |
|
221 |
||
1374
881f1ba7ca1e
Eat all user generated events if locked.
Stefan Vogel <sv@exept.de>
parents:
1371
diff
changeset
|
222 |
^ self gotEventForView:aView. |
1371 | 223 |
! |
224 |
||
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 | 227 |
|
228 |
! |
|
229 |
||
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 | 232 |
|
233 |
! |
|
234 |
||
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 | 237 |
|
238 |
! |
|
239 |
||
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 | 242 |
|
243 |
! |
|
244 |
||
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 | 247 |
|
248 |
! |
|
249 |
||
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 | 252 |
|
253 |
! ! |
|
254 |
||
255 |
!ScreenLock methodsFor:'lock interface'! |
|
256 |
||
257 |
checkTime |
|
258 |
||
259 |
|now| |
|
260 |
||
261 |
lockedViews isNil ifTrue:[ |
|
1966
b82e1cebf7af
Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents:
1462
diff
changeset
|
262 |
now := Timestamp now. |
1371 | 263 |
lastInactiveTime notNil ifTrue:[ |
264 |
(lastInactiveTime addSeconds:lockAfterSeconds value) < now ifTrue:[ |
|
265 |
self lock |
|
266 |
]. |
|
267 |
] ifFalse:[ |
|
268 |
lastInactiveTime := now. |
|
269 |
]. |
|
270 |
]. |
|
271 |
! |
|
272 |
||
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 | 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 | 277 |
! |
278 |
||
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 | 283 |
|
284 |
workstation removeEventListener:self |
|
285 |
! |
|
286 |
||
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 | 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 | 291 |
! ! |
292 |
||
293 |
!ScreenLock methodsFor:'private'! |
|
294 |
||
1374
881f1ba7ca1e
Eat all user generated events if locked.
Stefan Vogel <sv@exept.de>
parents:
1371
diff
changeset
|
295 |
gotEventForView:v |
1371 | 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 | 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 | 305 |
! |
306 |
||
307 |
initializeForDevice:aWorkstation |
|
308 |
||
309 |
lockAfterSeconds := 10. |
|
310 |
workstation := aWorkstation. |
|
311 |
workstation addEventListener:self. |
|
312 |
||
313 |
! |
|
314 |
||
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 | 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 | 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 | 333 |
]. |
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 | 338 |
! |
339 |
||
340 |
unlockScreen |
|
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 | 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 | 362 |
! ! |
363 |
||
364 |
!ScreenLock class methodsFor:'documentation'! |
|
365 |
||
366 |
version |
|
3847 | 367 |
^ '$Header$' |
1371 | 368 |
! ! |
3847 | 369 |