author | Claus Gittinger <cg@exept.de> |
Sat, 09 Nov 1996 17:01:12 +0100 | |
changeset 1111 | 13b350d13122 |
parent 1110 | 3ffcd22497fd |
child 1116 | c04e4739b42c |
permissions | -rw-r--r-- |
26 | 1 |
" |
2 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
72 | 3 |
All Rights Reserved |
26 | 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 |
" |
|
11 | 12 |
|
13 |
Object subclass:#WindowGroup |
|
317
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
14 |
instanceVariableNames:'views topViews myProcess mySensor isModal previousGroup focusView |
417 | 15 |
focusSequence preEventHook postEventHook pointerView |
16 |
isForModalSubview' |
|
956
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
17 |
classVariableNames:'LastActiveGroup LastActiveProcess LeaveSignal |
1110 | 18 |
WindowGroupQuerySignal LastEventQuerySignal' |
317
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
19 |
poolDictionaries:'' |
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
20 |
category:'Interface-Support' |
11 | 21 |
! |
22 |
||
1110 | 23 |
!WindowGroup class methodsFor:'documentation'! |
46 | 24 |
|
25 |
copyright |
|
26 |
" |
|
27 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
72 | 28 |
All Rights Reserved |
46 | 29 |
|
30 |
This software is furnished under a license and may be used |
|
31 |
only in accordance with the terms of that license and with the |
|
32 |
inclusion of the above copyright notice. This software may not |
|
33 |
be provided or otherwise made available to, or used by, any |
|
34 |
other person. No title to or ownership of the software is |
|
35 |
hereby transferred. |
|
36 |
" |
|
37 |
! |
|
38 |
||
39 |
documentation |
|
40 |
" |
|
103 | 41 |
In Smalltalk/X, the known (ST-80) concept of a controller has been |
297 | 42 |
extended (split) into a WindowGroup which handles process related stuff, |
43 |
and the Controller, which only handles events for a view and defines the user interaction. |
|
44 |
All interaction is via event queues - there is no polling in controllers (not even conceptionally). |
|
103 | 45 |
|
46 |
WindowGroups are responsible to wait for and forward events for a group of |
|
297 | 47 |
windows. All views in a windowGroup share a single windowSensor which holds the |
144 | 48 |
event queue (therefore views all share the same input event queue). |
49 |
||
297 | 50 |
The event queues are filled with incoming events as arriving from the physical display. |
51 |
This is done by a separate process (so called event-dispatcher) which runs at a higher |
|
52 |
priority. The event dispatcher determines the queue into which an event has to be placed |
|
53 |
by the view for which the event is destined (via the views sensor). |
|
54 |
There may be multiple event dispatchers running (to support multiple displays); |
|
55 |
see the documentation/examples in DeviceWorkstation/XWorkstation on how this is done. |
|
56 |
||
103 | 57 |
Except for modal boxes, a separate process is created for each windowGroup |
297 | 58 |
which waits for events to arrive and processes them, by sending corresponding |
144 | 59 |
event messages to the views controller or the view (*). |
297 | 60 |
The controller is determined by asking the view (for which the event is destined); |
61 |
if the returned controller is nil, the event is sent directly to the view. |
|
62 |
This allows for simple views to work without a controller. |
|
63 |
(all of this is actually done in a WindowEvent method) |
|
64 |
||
65 |
Therefore, multiple applications run pseudo parallel. |
|
66 |
Even if some window performs a long time computation, events are still received |
|
67 |
and entered into the corresponding event queues (because the event dispatcher process |
|
68 |
runs at a higher priority). However, the actual processing of the event is only |
|
69 |
possibly if no other process is busy at the same or a higher priority. |
|
70 |
It is possible to change a windowProcesses priority in order to give other windows |
|
71 |
a chance to execute (some views do this while performing longtime actions). |
|
72 |
||
103 | 73 |
Modal boxes create an extra window group for the components of the modal |
297 | 74 |
box, but execute the event-processing loop for this new group in the original process - |
144 | 75 |
therefore, the original windowgroup is blocked for the duration of the modal |
297 | 76 |
interaction. |
77 |
However, the modal-event processing loop peeks into the original groups event queue |
|
78 |
from time to time, and handles expose events. Thus, even while blocked for user input, |
|
79 |
the original group continues to get update/redraw events. |
|
103 | 80 |
|
81 |
Normally, one windowgroup is associated to each topview (StandardSystemView) |
|
144 | 82 |
and all of its subviews. However, this is not strictly required; |
83 |
it is possible to create extra windowgroups for subviews, which will let them |
|
84 |
run in parallel |
|
512 | 85 |
(for example, the FileBrowsers kill-Button is created that |
86 |
way, to allow a kill of an executing unix command, while the browser |
|
87 |
itself reads the pipeStream for incoming text. |
|
88 |
Even if the fileBrowser is busy reading the pipe, the killButton is still |
|
89 |
working and allows terminating the pipe-read action). |
|
144 | 90 |
|
91 |
On the other hand, multiple topviews can be placed into the same windowGroup; |
|
92 |
which allows for multiview applications, of which only one communicates with |
|
103 | 93 |
the user at a time. |
297 | 94 |
Multiple topviews within a windowGropup can be configured to behave like one |
95 |
unit with respect to iconification, deiconification and termination. |
|
96 |
This is done by creating multiple topViews in one group, and setting up a master/slave |
|
97 |
or partner relation among them (see TopView>>beSlave and TopView>>bePartner). |
|
103 | 98 |
|
109 | 99 |
WindowGroups also support a focus window: this is the one that gets the |
103 | 100 |
keyboard input - even if the cursor is located in another subview. |
512 | 101 |
The sequence is defined by the topView or its model (typically an applicationModel). |
102 |
It should return an orderedCollection of subviews when asked via #focusSequence. |
|
103 |
||
104 |
For debugging, windowGroups allow hooks to be installed around the processing of |
|
105 |
events - preEventHook is sent a #procesEvent: message before an event is processed, |
|
106 |
postEventHook is informed after the event has been processed. |
|
107 |
The preEventHook should return true - if it returns true, the event is considered |
|
108 |
being already processed by the hook and ignored. |
|
109 |
This allows for event-tracing, timing or even filtering (if preEventHook returns true). |
|
110 |
(notice: there is also an eventHook facility available in the sensor class.) |
|
103 | 111 |
|
112 |
Finally, windowgroups are the perfect place for things like defining a |
|
113 |
cursor for all associated views, flushing all input, waiting for expose |
|
114 |
events etc. |
|
115 |
||
297 | 116 |
Dont get confused: |
512 | 117 |
You dont have to care for details in the normal case, a windowgroup is |
118 |
created for you automatically, when a view is opened. |
|
119 |
All of the internals are not required to be known for most applications. |
|
297 | 120 |
|
103 | 121 |
|
597 | 122 |
[instance variables:] |
144 | 123 |
|
512 | 124 |
views collection of views of this group |
103 | 125 |
|
512 | 126 |
topViews collection of topviews of this group |
103 | 127 |
|
512 | 128 |
myProcess the process executing the events |
103 | 129 |
|
512 | 130 |
mySensor my input sensor |
103 | 131 |
|
512 | 132 |
isModal true if this is for a modal box |
103 | 133 |
|
512 | 134 |
previousGroup if modal, the group that started this one |
103 | 135 |
|
512 | 136 |
focusView the one that has the focus (or nil) |
103 | 137 |
|
512 | 138 |
focusSequence defines the focus sequence |
103 | 139 |
|
140 |
||
597 | 141 |
[class variables:] |
512 | 142 |
LeaveSignal if raised, a modal box leaves (closes) |
103 | 143 |
|
1111 | 144 |
WindowGroupQuerySignal to ask for the current windowGroup, |
145 |
anywhere in the program, simply raise this |
|
146 |
signal. The raise returns nil, for processes, |
|
147 |
which are not under control of a windowGroup. |
|
148 |
(i.e. wg := WindowGroup windowGroupQuerySignal raise) |
|
149 |
||
150 |
LastEventQuerySignal to ask for the event which was responsible |
|
151 |
for being where you are (whereever that is). |
|
152 |
The raise returns nil, if you did not arrive |
|
153 |
there due to an event. |
|
154 |
(i.e. ev := WindowGroup lastEventQuerySignal raise) |
|
155 |
The event can be asked for the view, the type |
|
156 |
of event, x/y position etc. |
|
103 | 157 |
|
144 | 158 |
(*) |
512 | 159 |
due to historic reasons, many views have the controller functionality |
160 |
integrated, and handle events themself. The windowSensor takes care |
|
161 |
of this, by checking if a view has a controller, and, if so, forwarding |
|
162 |
the events to it. Otherwise, events are sent directly to the view. |
|
144 | 163 |
|
512 | 164 |
In the future, all views will be rewritten to actually use a controller. |
165 |
Currently (being in the middle of this migration), only some views |
|
166 |
(buttons, toggles and subclasses) do so. |
|
144 | 167 |
|
103 | 168 |
For more information, read 'introduction to view programming' in the |
169 |
doc/online directory. |
|
597 | 170 |
|
612 | 171 |
[author:] |
172 |
Claus Gittinger |
|
173 |
||
597 | 174 |
[see also:] |
1111 | 175 |
WindowSensor WindowEvent EventListener KeyboardForwarder |
598 | 176 |
DeviceWorkstation |
597 | 177 |
View StandardSystemView |
178 |
ApplicationModel |
|
651 | 179 |
Process ProcessorScheduler |
180 |
(``Working with processes'': programming/processes.html#VIEWSNPROCS) |
|
46 | 181 |
" |
182 |
! ! |
|
183 |
||
1110 | 184 |
!WindowGroup class methodsFor:'initialization'! |
46 | 185 |
|
186 |
initialize |
|
187 |
LeaveSignal isNil ifTrue:[ |
|
956
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
188 |
LeaveSignal := (Signal new) mayProceed:true. |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
189 |
LeaveSignal nameClass:self message:#leaveSignal. |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
190 |
LeaveSignal notifierString:'unhandled leave signal'. |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
191 |
|
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
192 |
WindowGroupQuerySignal := QuerySignal new. |
1111 | 193 |
WindowGroupQuerySignal nameClass:self message:#windowGroupQuerySignal. |
194 |
WindowGroupQuerySignal notifierString:'query for windowgroup'. |
|
195 |
||
1110 | 196 |
LastEventQuerySignal := QuerySignal new. |
1111 | 197 |
LastEventQuerySignal nameClass:self message:#lastEventQuerySignal. |
198 |
LastEventQuerySignal notifierString:'query for last event'. |
|
54 | 199 |
]. |
46 | 200 |
|
201 |
"WindowGroup initialize" |
|
956
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
202 |
|
1111 | 203 |
"Modified: 9.11.1996 / 17:00:53 / cg" |
46 | 204 |
! ! |
205 |
||
1110 | 206 |
!WindowGroup class methodsFor:'instance creation'! |
244 | 207 |
|
208 |
new |
|
209 |
"create and return a new WindowGroup object" |
|
210 |
||
211 |
^ self basicNew initialize |
|
212 |
! ! |
|
213 |
||
1110 | 214 |
!WindowGroup class methodsFor:'Signal constants'! |
215 |
||
216 |
lastEventQuerySignal |
|
217 |
"return the signal which is used to query for the last event" |
|
218 |
||
219 |
^ LastEventQuerySignal |
|
220 |
||
221 |
"Created: 17.7.1996 / 20:36:04 / cg" |
|
222 |
! |
|
72 | 223 |
|
224 |
leaveSignal |
|
109 | 225 |
"return the signal which is used to exit a modal loop. |
144 | 226 |
This private signal, is always cought while a modalbox is active. |
227 |
Raising it will exit the modal loop and return from the views #openModal |
|
228 |
method." |
|
109 | 229 |
|
72 | 230 |
^ LeaveSignal |
956
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
231 |
! |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
232 |
|
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
233 |
windowGroupQuerySignal |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
234 |
"return the signal which is used to query for the windowGroup" |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
235 |
|
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
236 |
^ WindowGroupQuerySignal |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
237 |
|
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
238 |
"Created: 17.7.1996 / 20:36:04 / cg" |
72 | 239 |
! ! |
240 |
||
1110 | 241 |
!WindowGroup class methodsFor:'accessing'! |
26 | 242 |
|
243 |
activeGroup |
|
180 | 244 |
"return the currently active windowGroup. |
245 |
The returned value may not be fully correct, in case the current process |
|
246 |
handles multiple windowGroups simulaniously. In this case, |
|
247 |
the first group is returned (prefering a modal if there is one). |
|
248 |
(maybe we should return a collection of windowGroups here). |
|
249 |
||
250 |
This method is required to simulate the historic ST-80 single display |
|
251 |
behavior for Cursor>>show / Cursor>>showWhile and some others (raising the |
|
252 |
activeGroups topView when modalBoxes appear) on multiple display screens. |
|
253 |
These methods should change the cursor for the currently |
|
254 |
active windowGroup ONLY, instead of globally affecting the display or |
|
255 |
all views |
|
256 |
(since, depending on the priority, other views could be unaffacted by this |
|
257 |
and an overall cursor change does not make sense.)" |
|
258 |
||
259 |
|activeProcess groups wg| |
|
260 |
||
261 |
Processor isNil ifTrue:[^ nil]. "/ only during very early init phase |
|
26 | 262 |
|
180 | 263 |
activeProcess := Processor activeProcess. |
264 |
" caching the last value ..." |
|
565
6867f1a9a470
oops - leftover global LastActive
Claus Gittinger <cg@exept.de>
parents:
513
diff
changeset
|
265 |
activeProcess == LastActiveProcess ifTrue:[ |
956
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
266 |
LastActiveGroup process == LastActiveProcess ifTrue:[ |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
267 |
^ LastActiveGroup |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
268 |
] |
180 | 269 |
]. |
270 |
groups := self scheduledWindowGroups |
|
956
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
271 |
select:[:wg | wg process == activeProcess]. |
180 | 272 |
groups size == 1 ifTrue:[ |
956
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
273 |
wg := groups anElement |
180 | 274 |
] ifFalse:[ |
956
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
275 |
wg := groups detect:[:wg | wg isModal] ifNone:nil. |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
276 |
wg isNil ifTrue:[ |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
277 |
wg := groups anElement |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
278 |
] |
180 | 279 |
]. |
956
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
280 |
|
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
281 |
wg isNil ifTrue:[ |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
282 |
"/ mhmh - no windowGroup found; |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
283 |
"/ (possibly in a forked subProcess) |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
284 |
"/ try querySignal |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
285 |
WindowGroupQuerySignal isHandled ifTrue:[ |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
286 |
wg := WindowGroupQuerySignal raise |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
287 |
] |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
288 |
]. |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
289 |
|
180 | 290 |
wg notNil ifTrue:[ |
956
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
291 |
LastActiveProcess := activeProcess. |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
292 |
LastActiveGroup := wg. |
180 | 293 |
]. |
294 |
^ wg |
|
295 |
||
296 |
" |
|
297 |
WindowGroup activeGroup |
|
298 |
" |
|
299 |
||
300 |
"Modified: 3.9.1995 / 14:49:53 / claus" |
|
956
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
301 |
"Modified: 17.7.1996 / 15:39:19 / cg" |
54 | 302 |
! |
303 |
||
304 |
scheduledWindowGroups |
|
180 | 305 |
"return a collection of all windowGroups (possibly for different |
306 |
display devices) which are scheduled (i.e. which have a process |
|
307 |
running, handling events)." |
|
308 |
||
309 |
|set screens| |
|
310 |
||
311 |
screens := Screen allScreens. |
|
312 |
screens isNil ifTrue:[^ #()]. |
|
313 |
||
314 |
set := IdentitySet new. |
|
315 |
screens do:[:aDevice | |
|
316 |
aDevice allViewsDo:[:aView | |
|
317 |
|wg| |
|
109 | 318 |
|
180 | 319 |
(wg := aView windowGroup) notNil ifTrue:[ |
320 |
wg process notNil ifTrue:[ |
|
321 |
set add:wg |
|
322 |
] |
|
323 |
]. |
|
324 |
]. |
|
325 |
]. |
|
326 |
^ set asArray |
|
327 |
||
328 |
" |
|
329 |
WindowGroup scheduledWindowGroups |
|
330 |
" |
|
331 |
||
332 |
"Modified: 1.9.1995 / 13:43:09 / claus" |
|
244 | 333 |
! |
334 |
||
335 |
setActiveGroup:aGroup |
|
336 |
"set the currently active windowGroup. |
|
337 |
Temporary; do not use this interface, it will vanish." |
|
338 |
||
339 |
LastActiveProcess := Processor activeProcess. |
|
340 |
LastActiveGroup := aGroup |
|
26 | 341 |
! ! |
342 |
||
11 | 343 |
!WindowGroup methodsFor:'accessing'! |
344 |
||
512 | 345 |
device |
346 |
"return the device, we receive our events from" |
|
347 |
||
926
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
348 |
self obsoleteMethodWarning:'use #graphicsDevice'. |
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
349 |
^ self graphicsDevice |
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
350 |
|
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
351 |
"Modified: 5.7.1996 / 17:53:58 / cg" |
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
352 |
! |
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
353 |
|
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
354 |
graphicsDevice |
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
355 |
"return the device, we receive our events from" |
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
356 |
|
512 | 357 |
(topViews notNil and:[topViews isEmpty not]) ifTrue:[ |
743 | 358 |
^ topViews first graphicsDevice |
512 | 359 |
]. |
360 |
(views notNil and:[views isEmpty not]) ifTrue:[ |
|
743 | 361 |
^ views first graphicsDevice |
512 | 362 |
]. |
363 |
^ nil |
|
364 |
||
365 |
"Modified: 13.12.1995 / 14:18:11 / stefan" |
|
743 | 366 |
"Modified: 28.5.1996 / 20:26:59 / cg" |
926
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
367 |
"Created: 5.7.1996 / 17:53:31 / cg" |
512 | 368 |
! |
369 |
||
370 |
isModal |
|
371 |
"return true, if the receiver is in a modal mode |
|
372 |
(i.e. for a modal box)" |
|
373 |
||
374 |
^ isModal |
|
375 |
||
376 |
"Modified: 7.3.1996 / 14:29:46 / cg" |
|
377 |
! |
|
378 |
||
379 |
mainGroup |
|
380 |
"return the main windowgroup (for modal groups only) |
|
381 |
that is the top one, which is not modal. |
|
382 |
NonModal groups return themSelf. |
|
383 |
||
384 |
There is one exception to this: the debugger (which is sort of modal) |
|
385 |
returns itself as mainGroup (not its debuggee)." |
|
386 |
||
387 |
|g prev| |
|
388 |
||
389 |
g := self. |
|
390 |
[g notNil and:[g isModal and:[(prev := g previousGroup) notNil]]] whileTrue:[ |
|
391 |
g := prev |
|
392 |
]. |
|
393 |
^ g |
|
394 |
||
395 |
"Modified: 3.9.1995 / 14:57:20 / claus" |
|
396 |
"Modified: 7.3.1996 / 14:29:28 / cg" |
|
397 |
! |
|
398 |
||
399 |
previousGroup |
|
400 |
"return the windowgroup that started this group. (for modal groups only). |
|
401 |
This may be another modalGroup (for boxes opened by boxes). |
|
402 |
NonModal groups return nil." |
|
403 |
||
404 |
^ previousGroup |
|
405 |
||
406 |
"Modified: 7.3.1996 / 14:28:46 / cg" |
|
407 |
! |
|
408 |
||
409 |
process |
|
410 |
"return the windowGroups process" |
|
411 |
||
412 |
^ myProcess |
|
413 |
! |
|
414 |
||
415 |
sensor |
|
416 |
"return the windowGroups sensor. |
|
417 |
All events for any of the groups views is handled by that sensor." |
|
418 |
||
419 |
^ mySensor |
|
420 |
||
421 |
"Modified: 7.3.1996 / 14:30:21 / cg" |
|
422 |
! |
|
423 |
||
424 |
sensor:aSensor |
|
425 |
"set the windowGroups sensor" |
|
426 |
||
427 |
mySensor := aSensor |
|
428 |
! ! |
|
429 |
||
430 |
!WindowGroup methodsFor:'accessing-hook'! |
|
431 |
||
432 |
postEventHook |
|
433 |
"return the postEventHook if any" |
|
434 |
||
435 |
^ postEventHook |
|
436 |
||
437 |
"Created: 7.3.1996 / 14:42:46 / cg" |
|
438 |
! |
|
439 |
||
440 |
postEventHook:anObject |
|
441 |
"set the postEventHook - this one will get all events |
|
442 |
passed after being processed here (via #processEvent:)." |
|
443 |
||
444 |
postEventHook := anObject |
|
445 |
! |
|
446 |
||
447 |
preEventHook |
|
448 |
"return the preEventHook if any" |
|
449 |
||
450 |
^ preEventHook |
|
451 |
||
452 |
"Created: 7.3.1996 / 14:42:42 / cg" |
|
453 |
! |
|
454 |
||
455 |
preEventHook:anObject |
|
456 |
"set the preEventHook - this one will get all events |
|
457 |
passed before being processed here (via #processEvent:). |
|
458 |
If this returns true, the event is supposed to be already |
|
459 |
processed and ignored here. |
|
460 |
Otherwise, it is processed as usual." |
|
461 |
||
462 |
preEventHook := anObject |
|
463 |
! ! |
|
464 |
||
465 |
!WindowGroup methodsFor:'accessing-views'! |
|
466 |
||
244 | 467 |
addTopView:aView |
468 |
"add a topview to the group" |
|
26 | 469 |
|
244 | 470 |
topViews isNil ifTrue:[ |
500
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
471 |
topViews := OrderedCollection new. |
244 | 472 |
]. |
500
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
473 |
(topViews includesIdentical:aView) ifFalse:[ |
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
474 |
topViews add:aView |
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
475 |
] |
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
476 |
|
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
477 |
"Modified: 6.3.1996 / 15:35:15 / cg" |
26 | 478 |
! |
479 |
||
11 | 480 |
addView:aView |
26 | 481 |
"add aView to the windowGroup" |
482 |
||
11 | 483 |
views isNil ifTrue:[ |
500
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
484 |
views := OrderedCollection new. |
11 | 485 |
]. |
500
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
486 |
(views includesIdentical:aView) ifFalse:[ |
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
487 |
views add:aView |
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
488 |
] |
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
489 |
|
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
490 |
"Modified: 6.3.1996 / 15:35:41 / cg" |
11 | 491 |
! |
492 |
||
26 | 493 |
removeView:aView |
494 |
"remove aView from the windowGroup; |
|
495 |
if this was the last view in this group, |
|
81 | 496 |
also shut down the corresponding process |
497 |
(actually, only wake it up here - it will terminate itself |
|
498 |
when finding out that all views are gone)" |
|
11 | 499 |
|
263 | 500 |
|sema| |
501 |
||
11 | 502 |
views notNil ifTrue:[ |
72 | 503 |
views remove:aView ifAbsent:[]. |
504 |
views isEmpty ifTrue:[ |
|
505 |
views := nil |
|
506 |
] |
|
11 | 507 |
]. |
508 |
topViews notNil ifTrue:[ |
|
72 | 509 |
topViews remove:aView ifAbsent:[]. |
510 |
topViews isEmpty ifTrue:[ |
|
511 |
topViews := nil |
|
512 |
] |
|
11 | 513 |
]. |
54 | 514 |
" |
515 |
wakeup my process to look if last view has been |
|
262
546f42586e3c
only signal sema if there is one (when views are removed)
Claus Gittinger <cg@exept.de>
parents:
251
diff
changeset
|
516 |
removed (modalBoxes terminate their modalLoop if so) |
54 | 517 |
" |
262
546f42586e3c
only signal sema if there is one (when views are removed)
Claus Gittinger <cg@exept.de>
parents:
251
diff
changeset
|
518 |
mySensor notNil ifTrue:[ |
546f42586e3c
only signal sema if there is one (when views are removed)
Claus Gittinger <cg@exept.de>
parents:
251
diff
changeset
|
519 |
(sema := mySensor eventSemaphore) notNil ifTrue:[ |
546f42586e3c
only signal sema if there is one (when views are removed)
Claus Gittinger <cg@exept.de>
parents:
251
diff
changeset
|
520 |
sema signal |
546f42586e3c
only signal sema if there is one (when views are removed)
Claus Gittinger <cg@exept.de>
parents:
251
diff
changeset
|
521 |
] |
546f42586e3c
only signal sema if there is one (when views are removed)
Claus Gittinger <cg@exept.de>
parents:
251
diff
changeset
|
522 |
] |
11 | 523 |
! |
524 |
||
244 | 525 |
topViews |
526 |
"return the topviews accociated to this windowGroup" |
|
172 | 527 |
|
244 | 528 |
^ topViews |
172 | 529 |
! |
530 |
||
244 | 531 |
views |
532 |
"return the views accociated to this windowGroup" |
|
172 | 533 |
|
244 | 534 |
^ views |
54 | 535 |
! ! |
536 |
||
244 | 537 |
!WindowGroup methodsFor:'activation / deactivation'! |
538 |
||
539 |
closeDownViews |
|
540 |
"destroy all views associated to this window group" |
|
541 |
||
542 |
topViews notNil ifTrue:[ |
|
403 | 543 |
topViews do:[:aTopView | aTopView notNil ifTrue:[aTopView destroy]] |
244 | 544 |
]. |
545 |
views := nil. |
|
546 |
topViews := nil. |
|
547 |
mySensor := nil. |
|
548 |
! |
|
549 |
||
550 |
realizeTopViews:isRestart |
|
551 |
"realize all topViews associated to this windowGroup. |
|
552 |
If this is a restart, tell topViews about it." |
|
553 |
||
554 |
topViews notNil ifTrue:[ |
|
555 |
topViews do:[:aView | |
|
556 |
aView realize. |
|
557 |
isRestart ifTrue:[ |
|
558 |
aView restarted |
|
559 |
] |
|
560 |
]. |
|
561 |
]. |
|
562 |
! |
|
180 | 563 |
|
244 | 564 |
restart |
565 |
"restart after a snapin." |
|
180 | 566 |
|
244 | 567 |
topViews notNil ifTrue:[ |
568 |
" |
|
569 |
need a new semaphore, since obsolete processes |
|
570 |
(from our previous live) may still sit on the current semaphore |
|
571 |
" |
|
572 |
mySensor eventSemaphore:Semaphore new. |
|
573 |
isModal ifFalse:[ |
|
574 |
self startup:true |
|
575 |
] |
|
576 |
] |
|
577 |
! |
|
180 | 578 |
|
582
dbb1d19a1065
obsolete shutdown (use shutDown)
Claus Gittinger <cg@exept.de>
parents:
565
diff
changeset
|
579 |
shutDown |
dbb1d19a1065
obsolete shutdown (use shutDown)
Claus Gittinger <cg@exept.de>
parents:
565
diff
changeset
|
580 |
"shutdown the window group; close all views and |
244 | 581 |
terminate process" |
582 |
||
583 |
|p| |
|
584 |
||
585 |
self closeDownViews. |
|
586 |
myProcess notNil ifTrue:[ |
|
582
dbb1d19a1065
obsolete shutdown (use shutDown)
Claus Gittinger <cg@exept.de>
parents:
565
diff
changeset
|
587 |
p := myProcess. |
dbb1d19a1065
obsolete shutdown (use shutDown)
Claus Gittinger <cg@exept.de>
parents:
565
diff
changeset
|
588 |
myProcess := nil. |
dbb1d19a1065
obsolete shutdown (use shutDown)
Claus Gittinger <cg@exept.de>
parents:
565
diff
changeset
|
589 |
p terminate. |
244 | 590 |
] |
582
dbb1d19a1065
obsolete shutdown (use shutDown)
Claus Gittinger <cg@exept.de>
parents:
565
diff
changeset
|
591 |
|
dbb1d19a1065
obsolete shutdown (use shutDown)
Claus Gittinger <cg@exept.de>
parents:
565
diff
changeset
|
592 |
"Created: 22.4.1996 / 17:58:37 / cg" |
180 | 593 |
! |
594 |
||
244 | 595 |
startup:isRestart |
596 |
"startup the window-group; |
|
597 |
this creates a new window group process, which |
|
598 |
does the event processing." |
|
599 |
||
600 |
|top nm dev devNm| |
|
601 |
||
602 |
previousGroup := nil. |
|
603 |
myProcess isNil ifTrue:[ |
|
743 | 604 |
isModal := false. |
605 |
myProcess := [ |
|
606 |
self realizeTopViews:isRestart. |
|
607 |
self eventLoopWhile:[true] onLeave:[] |
|
608 |
] forkAt:Processor userSchedulingPriority. |
|
180 | 609 |
|
743 | 610 |
(topViews notNil and:[topViews isEmpty not]) ifTrue:[ |
611 |
" |
|
612 |
give the handler process a user friendly name |
|
613 |
" |
|
614 |
top := topViews first. |
|
615 |
nm := top processName. |
|
616 |
(dev := top graphicsDevice) notNil ifTrue:[ |
|
617 |
devNm := dev displayName. |
|
618 |
(devNm notNil and:[devNm ~= Display displayName]) ifTrue:[ |
|
619 |
nm := nm , ' (' , devNm , ')' |
|
620 |
] |
|
621 |
] |
|
622 |
] ifFalse:[ |
|
623 |
nm := 'window handler'. |
|
624 |
]. |
|
625 |
myProcess name:nm. |
|
931
00fd4b461c31
renamed beProcessGroupLeader to beGroupLeader
Claus Gittinger <cg@exept.de>
parents:
930
diff
changeset
|
626 |
myProcess beGroupLeader. |
180 | 627 |
|
743 | 628 |
" |
629 |
when the process gets suspended, there maybe still buffered draw requests. |
|
630 |
Flush them. |
|
631 |
" |
|
632 |
myProcess suspendAction:[ |
|
633 |
|dev| |
|
926
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
634 |
dev := self graphicsDevice. |
743 | 635 |
dev notNil ifTrue:[dev flush]. |
636 |
]. |
|
313 | 637 |
|
743 | 638 |
"when the process dies, we have to close-down |
639 |
the views as well |
|
640 |
" |
|
641 |
myProcess exitAction:[self closeDownViews] |
|
244 | 642 |
] |
313 | 643 |
|
644 |
"Modified: 13.12.1995 / 14:04:53 / stefan" |
|
931
00fd4b461c31
renamed beProcessGroupLeader to beGroupLeader
Claus Gittinger <cg@exept.de>
parents:
930
diff
changeset
|
645 |
"Modified: 8.7.1996 / 14:08:55 / cg" |
180 | 646 |
! |
647 |
||
244 | 648 |
startupModal:checkBlock |
301
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
649 |
"startup the window-group in a modal loop |
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
650 |
(i.e. under the currently running process); |
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
651 |
checkBlock is evaluated and the modal loop is left, whenever false is returned." |
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
652 |
|
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
653 |
^ self startupModal:checkBlock forGroup:WindowGroup activeGroup. |
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
654 |
|
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
655 |
"Created: 10.12.1995 / 14:15:11 / cg" |
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
656 |
! |
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
657 |
|
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
658 |
startupModal:checkBlock forGroup:mainGroup |
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
659 |
"startup the window-group in a modal loop |
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
660 |
(i.e. under the currently running process); |
244 | 661 |
checkBlock is evaluated and loop is left, when false is |
301
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
662 |
returned. |
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
663 |
The mainGroup info is required to allow peeking into its |
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
664 |
event queue in order for its expose/redraws to be handled." |
244 | 665 |
|
666 |
"set previousGroup to the main (non-modal) group" |
|
180 | 667 |
|
301
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
668 |
previousGroup := mainGroup. |
244 | 669 |
isModal := true. |
956
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
670 |
|
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
671 |
WindowGroupQuerySignal handle:[:ex | |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
672 |
ex proceedWith:self |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
673 |
] do:[ |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
674 |
self realizeTopViews:false. |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
675 |
self |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
676 |
eventLoopWhile:checkBlock |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
677 |
onLeave:[ |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
678 |
" |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
679 |
cleanup, in case of a terminate |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
680 |
" |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
681 |
previousGroup := nil. |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
682 |
topViews := nil. |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
683 |
views := nil. |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
684 |
" |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
685 |
the following is rubbish; |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
686 |
the views could be reused .. |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
687 |
" |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
688 |
" |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
689 |
topViews notNil ifTrue:[ |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
690 |
topViews do:[:aView | |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
691 |
aView destroy |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
692 |
]. |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
693 |
topViews := nil. |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
694 |
]. |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
695 |
views notNil ifTrue:[ |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
696 |
views do:[:aView | |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
697 |
aView destroy |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
698 |
]. |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
699 |
views := nil. |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
700 |
]. |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
701 |
" |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
702 |
] |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
703 |
] |
301
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
704 |
|
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
705 |
"Created: 10.12.1995 / 14:14:26 / cg" |
956
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
706 |
"Modified: 17.7.1996 / 15:40:37 / cg" |
180 | 707 |
! ! |
708 |
||
90 | 709 |
!WindowGroup methodsFor:'enumerating'! |
54 | 710 |
|
711 |
allTopViewsExcept:aView do:aBlock |
|
157 | 712 |
"evaluate aBlock for all topviews except aView in this group. |
713 |
This works on a copy of the view collection, to allow for |
|
158 | 714 |
destroy and other collection changing operations to be done." |
157 | 715 |
|
716 |
topViews notNil ifTrue:[ |
|
717 |
topViews copy do:[:v | |
|
718 |
v ~~ aView ifTrue:[aBlock value:v] |
|
719 |
] |
|
720 |
]. |
|
721 |
! |
|
722 |
||
244 | 723 |
allViewsDo:aBlock |
724 |
"evaluate aBlock for all views & topviews in this group. |
|
725 |
This works on a copy of the view collection, to allow for |
|
726 |
destroy and other collection changing operations to be done." |
|
727 |
||
728 |
topViews notNil ifTrue:[topViews copy do:aBlock]. |
|
729 |
views notNil ifTrue:[views copy do:aBlock] |
|
730 |
! |
|
731 |
||
732 |
partnersDo:aBlock |
|
733 |
"evaluate aBlock for all partnerViews. |
|
734 |
This works on a copy of the view collection, to allow for |
|
735 |
destroy and other collection changing operations to be done." |
|
736 |
||
737 |
topViews notNil ifTrue:[ |
|
738 |
topViews copy do:[:v | |
|
739 |
v notNil ifTrue:[ |
|
740 |
v type == #partner ifTrue:[aBlock value:v]. |
|
741 |
] |
|
742 |
] |
|
743 |
]. |
|
744 |
! |
|
745 |
||
157 | 746 |
slavesDo:aBlock |
747 |
"evaluate aBlock for all slaveViews. |
|
748 |
This works on a copy of the view collection, to allow for |
|
158 | 749 |
destroy and other collection changing operations to be done." |
54 | 750 |
|
751 |
topViews notNil ifTrue:[ |
|
157 | 752 |
topViews copy do:[:v | |
753 |
v notNil ifTrue:[ |
|
754 |
v type == #slave ifTrue:[aBlock value:v]. |
|
755 |
] |
|
756 |
] |
|
757 |
]. |
|
11 | 758 |
! ! |
759 |
||
605
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
760 |
!WindowGroup methodsFor:'event debugging'! |
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
761 |
|
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
762 |
traceEvents:trueOrFalse |
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
763 |
|hook| |
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
764 |
|
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
765 |
trueOrFalse ifFalse:[ |
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
766 |
"/ |
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
767 |
"/ remove any eventHook on the receiver |
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
768 |
"/ |
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
769 |
self preEventHook:nil. |
697 | 770 |
"/ Transcript showCR:'removed eventHook'. |
605
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
771 |
] ifTrue:[ |
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
772 |
"/ |
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
773 |
"/ set an eventHook on its windowGroup |
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
774 |
"/ |
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
775 |
hook := Plug new. |
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
776 |
hook respondTo:#processEvent: |
698 | 777 |
with:[:ev | ev displayString printCR. false]. |
605
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
778 |
|
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
779 |
self preEventHook:hook. |
697 | 780 |
"/ Transcript showCR:'set eventHook for tracing'. |
605
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
781 |
] |
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
782 |
|
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
783 |
"Created: 24.4.1996 / 10:25:21 / cg" |
698 | 784 |
"Modified: 20.5.1996 / 10:30:00 / cg" |
605
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
785 |
! ! |
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
786 |
|
19 | 787 |
!WindowGroup methodsFor:'event handling'! |
11 | 788 |
|
244 | 789 |
eventLoop |
790 |
"loop executed by windowGroup process; |
|
791 |
wait-for and process events forever" |
|
792 |
||
793 |
self eventLoopWhile:[true] onLeave:[] |
|
794 |
! |
|
795 |
||
796 |
eventLoopWhile:aBlock onLeave:cleanupActions |
|
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
797 |
"wait-for and process events. |
244 | 798 |
Stay in this loop while there are still any views to dispatch for, |
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
799 |
and aBlock evaluates to true. |
244 | 800 |
|
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
801 |
Some signals are cought & handled: |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
802 |
LeaveSignal forces an exit from the eventLoop; |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
803 |
AbortSignal brings us back into the loop, processing the next event." |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
804 |
|
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
805 |
|thisProcess sigs| |
244 | 806 |
|
807 |
thisProcess := Processor activeProcess. |
|
808 |
||
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
809 |
sigs := SignalSet |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
810 |
with:AbortSignal |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
811 |
with:LeaveSignal |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
812 |
with:ActivityNotificationSignal. |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
813 |
|
244 | 814 |
[ |
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
815 |
|p g mainGroup mySema waitSema| |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
816 |
|
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
817 |
waitSema := mySema := mySensor eventSemaphore. |
325
b24d9a1c74dc
stefans modalBox changes (no more polling)
Claus Gittinger <cg@exept.de>
parents:
324
diff
changeset
|
818 |
|
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
819 |
isModal ifTrue:[ |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
820 |
mainGroup := self mainGroup. |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
821 |
mainGroup == self ifTrue:[ |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
822 |
mainGroup := nil |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
823 |
]. |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
824 |
mainGroup notNil ifTrue:[ |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
825 |
waitSema := SemaphoreSet with:mySema |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
826 |
with:(mainGroup sensor eventSemaphore). |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
827 |
]. |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
828 |
]. |
244 | 829 |
|
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
830 |
[aBlock value] whileTrue:[ |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
831 |
LastActiveGroup := self. |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
832 |
LastActiveProcess := thisProcess. |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
833 |
|
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
834 |
(views isNil and:[topViews isNil]) ifTrue:[ |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
835 |
myProcess notNil ifTrue:[ |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
836 |
p := myProcess. |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
837 |
myProcess := nil. |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
838 |
p terminate. |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
839 |
"not reached - there is no life after death" |
429 | 840 |
]. |
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
841 |
" |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
842 |
this is the end of a modal loop |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
843 |
(not having a private process ...) |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
844 |
" |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
845 |
^ self |
429 | 846 |
]. |
244 | 847 |
|
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
848 |
"/ |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
849 |
"/ on abort, stay in the event loop |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
850 |
"/ |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
851 |
sigs handle:[:ex | |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
852 |
|theSig| |
244 | 853 |
|
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
854 |
(theSig := ex signal) == AbortSignal ifTrue:[ |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
855 |
"/ |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
856 |
"/ on abort, stay in loop |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
857 |
"/ |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
858 |
ex return |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
859 |
]. |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
860 |
theSig == LeaveSignal ifTrue:[ |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
861 |
"/ |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
862 |
"/ on leave, exit the event loop |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
863 |
"/ |
429 | 864 |
^ self |
865 |
]. |
|
323
619085d52522
be careful - device may be nil
Claus Gittinger <cg@exept.de>
parents:
319
diff
changeset
|
866 |
|
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
867 |
"/ ActivityNotification |
429 | 868 |
"/ |
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
869 |
"/ if I am a modal-group, let it be handled |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
870 |
"/ by the outer main-groups handler |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
871 |
"/ otherwise show the activityMessage and continue. |
429 | 872 |
"/ |
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
873 |
isModal ifTrue:[ |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
874 |
ex reject |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
875 |
"never reached" |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
876 |
]. |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
877 |
self showActivity:(ex errorString). |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
878 |
ex proceed. |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
879 |
] do:[ |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
880 |
|dev gotSema mainView| |
429 | 881 |
|
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
882 |
"/ no more events. Flush device output. This may produce more events. |
926
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
883 |
dev := self graphicsDevice. |
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
884 |
dev notNil ifTrue:[dev flush]. |
328 | 885 |
|
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
886 |
thisProcess setStateTo:#eventWait if:#active. |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
887 |
gotSema := waitSema wait. |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
888 |
LastActiveGroup := self. |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
889 |
LastActiveProcess := thisProcess. |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
890 |
gotSema == mySema ifTrue:[ |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
891 |
self processEvents |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
892 |
] ifFalse:[ |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
893 |
mainGroup topViews notNil ifTrue:[ |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
894 |
mainView := mainGroup topViews first |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
895 |
]. |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
896 |
mainView notNil ifTrue:[ |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
897 |
(mainGroup sensor hasConfigureEventFor:mainView) ifTrue:[ |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
898 |
topViews first raiseDeiconified |
429 | 899 |
] |
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
900 |
]. |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
901 |
" |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
902 |
if modal, also check for redraw events in my maingroup |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
903 |
(we arrive here after we woke up on maingroup sensor eventSemaphore) |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
904 |
" |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
905 |
mainGroup processExposeEvents. |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
906 |
] |
429 | 907 |
]. |
908 |
]. |
|
244 | 909 |
] valueNowOrOnUnwindDo:[ |
429 | 910 |
cleanupActions notNil ifTrue:[cleanupActions value] |
244 | 911 |
] |
313 | 912 |
|
325
b24d9a1c74dc
stefans modalBox changes (no more polling)
Claus Gittinger <cg@exept.de>
parents:
324
diff
changeset
|
913 |
"Modified: 14.12.1995 / 11:12:24 / stefan" |
926
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
914 |
"Modified: 5.7.1996 / 17:54:25 / cg" |
244 | 915 |
! |
916 |
||
917 |
leaveEventLoop |
|
918 |
"immediately leave the event loop, returning way back. |
|
919 |
This can be used to leave (and closedown) a modal group. |
|
920 |
(for normal views, this does not make sense)" |
|
921 |
||
922 |
^ LeaveSignal raise |
|
923 |
! |
|
924 |
||
103 | 925 |
processEvents |
926 |
"process events from either the damage- or user input queues. |
|
927 |
Abort is assumed to be handled elsewhere." |
|
19 | 928 |
|
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
929 |
<resource: #keyboard (#Escape )> |
496 | 930 |
|
388
64e43f82d93e
Escape leaves modalBoxes or PopUpViews
Claus Gittinger <cg@exept.de>
parents:
387
diff
changeset
|
931 |
|event ignore key| |
11 | 932 |
|
72 | 933 |
self processExposeEvents. |
180 | 934 |
|
72 | 935 |
[mySensor hasEvents] whileTrue:[ |
496 | 936 |
event := mySensor nextEvent. |
937 |
event notNil ifTrue:[ |
|
938 |
(views notNil or:[topViews notNil]) ifTrue:[ |
|
1110 | 939 |
LastEventQuerySignal handle:[:ex | |
940 |
ex proceedWith:event |
|
941 |
] do:[ |
|
942 |
ignore := false. |
|
943 |
||
944 |
(preEventHook notNil |
|
945 |
and:[preEventHook processEvent:event]) ifTrue:[ |
|
946 |
ignore := true. |
|
947 |
]. |
|
948 |
ignore ifFalse:[ |
|
949 |
event isKeyPressEvent ifTrue:[ |
|
950 |
key := event key. |
|
172 | 951 |
|
1110 | 952 |
key == #Escape ifTrue:[ |
953 |
isModal ifTrue:[ |
|
954 |
topViews first hideRequest |
|
955 |
] |
|
956 |
] |
|
957 |
]. |
|
958 |
event isPointerEnterEvent ifTrue:[ |
|
959 |
pointerView := event view |
|
960 |
]. |
|
961 |
event isPointerLeaveEvent ifTrue:[ |
|
962 |
pointerView := nil |
|
963 |
]. |
|
500
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
964 |
|
1110 | 965 |
ignore ifFalse:[ |
966 |
"/ |
|
967 |
"/ button events turn off explicit focus, and revert |
|
968 |
"/ to implicit focus control |
|
969 |
"/ |
|
970 |
(focusView notNil |
|
971 |
and:[event isButtonEvent]) ifTrue:[ |
|
972 |
self focusView:nil |
|
973 |
]. |
|
974 |
"/ |
|
975 |
"/ let the event forward itself |
|
976 |
"/ |
|
977 |
LastActiveGroup := self. |
|
978 |
LastActiveProcess := Processor activeProcess. |
|
979 |
event sendEventWithFocusOn:focusView. |
|
496 | 980 |
] |
981 |
]. |
|
1110 | 982 |
postEventHook notNil ifTrue:[ |
983 |
postEventHook processEvent:event |
|
496 | 984 |
] |
985 |
] |
|
986 |
] |
|
987 |
]. |
|
72 | 988 |
] |
357
3655807445b7
keep track of pointerView, for implizit focus tracking
Claus Gittinger <cg@exept.de>
parents:
330
diff
changeset
|
989 |
|
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
990 |
"Modified: 7.3.1996 / 17:46:27 / cg" |
48 | 991 |
! |
992 |
||
993 |
processExposeEvents |
|
103 | 994 |
"process only expose events from the damage queue" |
48 | 995 |
|
180 | 996 |
|event view rect x y w h sensor thisProcess| |
109 | 997 |
|
998 |
(sensor := mySensor) isNil ifTrue:[^ self]. |
|
48 | 999 |
|
180 | 1000 |
thisProcess := Processor activeProcess. |
1001 |
||
1002 |
[sensor hasDamage] whileTrue:[ |
|
1110 | 1003 |
LastActiveGroup := self. |
1004 |
LastActiveProcess := thisProcess. |
|
180 | 1005 |
|
1110 | 1006 |
event := sensor nextDamage. |
1007 |
event notNil ifTrue:[ |
|
1008 |
(views notNil or:[topViews notNil]) ifTrue:[ |
|
1009 |
LastEventQuerySignal handle:[:ex | |
|
1010 |
ex proceedWith:event |
|
1011 |
] do:[ |
|
1012 |
(preEventHook notNil |
|
1013 |
and:[preEventHook processEvent:event]) ifFalse:[ |
|
1014 |
event isDamage ifTrue:[ |
|
1015 |
view := event view. |
|
1016 |
"/ |
|
1017 |
"/ if the view is no longer shown (iconified or closed), |
|
1018 |
"/ this is a leftover event and ignored. |
|
1019 |
"/ |
|
1020 |
view shown ifTrue:[ |
|
1021 |
rect := event rectangle. |
|
1022 |
x := rect left. |
|
1023 |
y := rect top. |
|
1024 |
w := rect width. |
|
1025 |
h := rect height. |
|
1026 |
LastActiveGroup := self. |
|
1027 |
LastActiveProcess := thisProcess. |
|
1028 |
view transformation notNil ifTrue:[ |
|
1029 |
view deviceExposeX:x y:y width:w height:h |
|
1030 |
] ifFalse:[ |
|
1031 |
view exposeX:x y:y width:w height:h |
|
1032 |
] |
|
1033 |
] |
|
1034 |
] ifFalse:[ |
|
1035 |
" |
|
1036 |
mhmh - could we possibly arrive here ? |
|
1037 |
" |
|
1038 |
LastActiveGroup := self. |
|
1039 |
LastActiveProcess := thisProcess. |
|
1040 |
event sendEvent. |
|
1041 |
] |
|
1042 |
]. |
|
1043 |
postEventHook notNil ifTrue:[ |
|
1044 |
postEventHook processEvent:event |
|
1045 |
] |
|
1046 |
] |
|
1047 |
] |
|
1048 |
] |
|
90 | 1049 |
] |
11 | 1050 |
! |
1051 |
||
28 | 1052 |
waitForExposeFor:aView |
500
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
1053 |
"wait for a noExpose event for aView, then process all exposes. |
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
1054 |
To be used after a scroll. |
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
1055 |
This is very Xspecific and not needed with other systems |
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
1056 |
(i.e. a synthetic noExpose may be generated there)." |
28 | 1057 |
|
1058 |
mySensor waitForExposeFor:aView. |
|
90 | 1059 |
AbortSignal catch:[ |
500
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
1060 |
self processExposeEvents |
90 | 1061 |
] |
500
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
1062 |
|
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
1063 |
"Modified: 6.3.1996 / 15:58:36 / cg" |
11 | 1064 |
! ! |
19 | 1065 |
|
90 | 1066 |
!WindowGroup methodsFor:'focus control'! |
1067 |
||
244 | 1068 |
focusNext |
949
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1069 |
"give focus to the next view in the focusSequence. |
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1070 |
Skip invisible views." |
500
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
1071 |
|
949
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1072 |
|index index0 last next| |
244 | 1073 |
|
507
5098d8e9be3c
oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents:
500
diff
changeset
|
1074 |
focusSequence := self focusSequence. |
5098d8e9be3c
oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents:
500
diff
changeset
|
1075 |
(last := focusSequence size) == 0 ifTrue:[^ self]. |
244 | 1076 |
|
1077 |
focusView notNil ifTrue:[ |
|
949
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1078 |
index := index0 := (focusSequence identityIndexOf:focusView). |
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1079 |
] ifFalse:[ |
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1080 |
index := 0. |
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1081 |
]. |
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1082 |
|
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1083 |
[next isNil] whileTrue:[ |
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1084 |
index := index + 1. |
500
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
1085 |
index > last ifTrue:[ |
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
1086 |
index := 1. |
949
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1087 |
index0 isNil ifTrue:[^ self]. |
500
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
1088 |
]. |
949
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1089 |
index == index0 ifTrue:[^ self]. |
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1090 |
|
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1091 |
next := (focusSequence at:index). |
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1092 |
next realized not ifTrue:[ |
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1093 |
next := nil |
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1094 |
]. |
244 | 1095 |
]. |
949
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1096 |
|
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1097 |
self focusView:next |
244 | 1098 |
|
1099 |
" |
|
1100 |
|top v1 v2| |
|
1101 |
||
1102 |
top := StandardSystemView new. |
|
1103 |
v1 := EditTextView origin:0.0@0.0 corner:1.0@0.5 in:top. |
|
1104 |
v2 := EditTextView origin:0.0@0.5 corner:1.0@1.0 in:top. |
|
1105 |
top open. |
|
1106 |
top windowGroup focusSequence:(Array with:v1 with:v2). |
|
1107 |
top windowGroup focusOn:v1. |
|
1108 |
(Delay forSeconds:10) wait. |
|
1109 |
top windowGroup focusNext. |
|
1110 |
" |
|
500
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
1111 |
|
949
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1112 |
"Modified: 17.7.1996 / 12:27:30 / cg" |
244 | 1113 |
! |
1114 |
||
1115 |
focusPrevious |
|
1116 |
"give focus to previous view in focusSequence" |
|
1117 |
||
949
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1118 |
|index prev index0| |
244 | 1119 |
|
507
5098d8e9be3c
oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents:
500
diff
changeset
|
1120 |
focusSequence := self focusSequence. |
244 | 1121 |
focusSequence size == 0 ifTrue:[^ self]. |
507
5098d8e9be3c
oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents:
500
diff
changeset
|
1122 |
|
244 | 1123 |
focusView notNil ifTrue:[ |
949
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1124 |
index := index0 := (focusSequence identityIndexOf:focusView). |
244 | 1125 |
] ifFalse:[ |
949
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1126 |
index := focusSequence size + 1. |
244 | 1127 |
]. |
949
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1128 |
|
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1129 |
[prev isNil] whileTrue:[ |
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1130 |
index := index - 1. |
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1131 |
index < 1 ifTrue:[ |
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1132 |
index := focusSequence size. |
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1133 |
index0 isNil ifTrue:[^ self]. |
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1134 |
]. |
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1135 |
index == index0 ifTrue:[^ self]. |
500
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
1136 |
|
949
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1137 |
prev := (focusSequence at:index). |
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1138 |
prev realized not ifTrue:[ |
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1139 |
prev := nil |
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1140 |
]. |
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1141 |
]. |
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1142 |
|
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1143 |
self focusView:prev |
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1144 |
|
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1145 |
"Modified: 17.7.1996 / 12:42:10 / cg" |
244 | 1146 |
! |
1147 |
||
135 | 1148 |
focusSequence |
500
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
1149 |
"return my focus sequence for focusNext/focusPrevious. |
135 | 1150 |
Focus is stepped in the order in which subviews occur in |
1151 |
the sequence" |
|
1152 |
||
507
5098d8e9be3c
oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents:
500
diff
changeset
|
1153 |
focusSequence notNil ifTrue:[^ focusSequence]. |
500
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
1154 |
|
507
5098d8e9be3c
oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents:
500
diff
changeset
|
1155 |
topViews do:[:top | |
5098d8e9be3c
oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents:
500
diff
changeset
|
1156 |
focusSequence := top focusSequence. |
5098d8e9be3c
oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents:
500
diff
changeset
|
1157 |
focusSequence notNil ifTrue:[^ focusSequence]. |
5098d8e9be3c
oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents:
500
diff
changeset
|
1158 |
]. |
5098d8e9be3c
oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents:
500
diff
changeset
|
1159 |
|
5098d8e9be3c
oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents:
500
diff
changeset
|
1160 |
^ nil |
5098d8e9be3c
oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents:
500
diff
changeset
|
1161 |
|
5098d8e9be3c
oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents:
500
diff
changeset
|
1162 |
"Modified: 6.3.1996 / 17:50:01 / cg" |
135 | 1163 |
! |
1164 |
||
90 | 1165 |
focusSequence:aSequenceableCollection |
1166 |
"define the focus sequence for focusNext/focusPrevious. |
|
1167 |
Focus is stepped in the order in which subviews occur in |
|
1168 |
the sequence" |
|
1169 |
||
1170 |
focusSequence := aSequenceableCollection |
|
1171 |
! |
|
1172 |
||
1173 |
focusView |
|
135 | 1174 |
"return the view which currently has the focus" |
90 | 1175 |
|
1176 |
^ focusView |
|
1177 |
! |
|
1178 |
||
1179 |
focusView:aViewOrNil |
|
1180 |
"give focus to aViewOrNil" |
|
1181 |
||
410
9d9d03fa5d82
moved Tab handling to topView (which sends #focusNext if no subview handled it)
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1182 |
focusView == aViewOrNil ifTrue:[^ self]. |
9d9d03fa5d82
moved Tab handling to topView (which sends #focusNext if no subview handled it)
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1183 |
|
90 | 1184 |
focusView notNil ifTrue:[ |
777
4d0b66f65346
search in focusSequence for identical view - who knows
Claus Gittinger <cg@exept.de>
parents:
743
diff
changeset
|
1185 |
"/ lost explicit focus |
4d0b66f65346
search in focusSequence for identical view - who knows
Claus Gittinger <cg@exept.de>
parents:
743
diff
changeset
|
1186 |
focusView == aViewOrNil ifTrue:[^ self]. |
4d0b66f65346
search in focusSequence for identical view - who knows
Claus Gittinger <cg@exept.de>
parents:
743
diff
changeset
|
1187 |
focusView showNoFocus:true. |
357
3655807445b7
keep track of pointerView, for implizit focus tracking
Claus Gittinger <cg@exept.de>
parents:
330
diff
changeset
|
1188 |
] ifFalse:[ |
777
4d0b66f65346
search in focusSequence for identical view - who knows
Claus Gittinger <cg@exept.de>
parents:
743
diff
changeset
|
1189 |
pointerView notNil ifTrue:[ |
4d0b66f65346
search in focusSequence for identical view - who knows
Claus Gittinger <cg@exept.de>
parents:
743
diff
changeset
|
1190 |
pointerView ~~ aViewOrNil ifTrue:[ |
4d0b66f65346
search in focusSequence for identical view - who knows
Claus Gittinger <cg@exept.de>
parents:
743
diff
changeset
|
1191 |
"/ lost implicit focus |
4d0b66f65346
search in focusSequence for identical view - who knows
Claus Gittinger <cg@exept.de>
parents:
743
diff
changeset
|
1192 |
pointerView showNoFocus:false |
4d0b66f65346
search in focusSequence for identical view - who knows
Claus Gittinger <cg@exept.de>
parents:
743
diff
changeset
|
1193 |
] |
4d0b66f65346
search in focusSequence for identical view - who knows
Claus Gittinger <cg@exept.de>
parents:
743
diff
changeset
|
1194 |
]. |
90 | 1195 |
]. |
387
aa80487842b8
compile event classes with optSpace;
Claus Gittinger <cg@exept.de>
parents:
385
diff
changeset
|
1196 |
|
90 | 1197 |
focusView := aViewOrNil. |
1198 |
focusView notNil ifTrue:[ |
|
777
4d0b66f65346
search in focusSequence for identical view - who knows
Claus Gittinger <cg@exept.de>
parents:
743
diff
changeset
|
1199 |
"/ got explicit focus |
4d0b66f65346
search in focusSequence for identical view - who knows
Claus Gittinger <cg@exept.de>
parents:
743
diff
changeset
|
1200 |
focusView showFocus:true. |
90 | 1201 |
]. |
1202 |
||
1203 |
" |
|
1204 |
|top v1 v2| |
|
1205 |
||
1206 |
top := StandardSystemView new. |
|
1207 |
v1 := EditTextView origin:0.0@0.0 corner:1.0@0.5 in:top. |
|
1208 |
v2 := EditTextView origin:0.0@0.5 corner:1.0@1.0 in:top. |
|
1209 |
top open. |
|
1210 |
top windowGroup focusView:v1. |
|
1211 |
" |
|
357
3655807445b7
keep track of pointerView, for implizit focus tracking
Claus Gittinger <cg@exept.de>
parents:
330
diff
changeset
|
1212 |
|
777
4d0b66f65346
search in focusSequence for identical view - who knows
Claus Gittinger <cg@exept.de>
parents:
743
diff
changeset
|
1213 |
"Modified: 31.5.1996 / 21:13:25 / cg" |
244 | 1214 |
! ! |
1215 |
||
1216 |
!WindowGroup methodsFor:'initialization'! |
|
1217 |
||
1218 |
initialize |
|
1219 |
"setup the windowgroup, by creating a new sensor |
|
1220 |
and an event semaphore" |
|
1221 |
||
1222 |
mySensor := WindowSensor new. |
|
1223 |
mySensor eventSemaphore:Semaphore new. |
|
1224 |
isModal := false. |
|
417 | 1225 |
isForModalSubview := false. |
90 | 1226 |
! |
1227 |
||
244 | 1228 |
reinitialize |
1229 |
"reinitialize the windowgroup after an image restart" |
|
90 | 1230 |
|
244 | 1231 |
"throw away old (zombie) process" |
1232 |
myProcess notNil ifTrue:[ |
|
1233 |
"careful: the old processes exitaction must be cleared |
|
1234 |
otherwise, it might do destroy or other actions when it |
|
1235 |
gets finalized ... |
|
1236 |
" |
|
1237 |
myProcess exitAction:nil. |
|
313 | 1238 |
myProcess suspendAction:nil. |
244 | 1239 |
myProcess := nil. |
1240 |
]. |
|
90 | 1241 |
|
244 | 1242 |
"throw away old events" |
1243 |
mySensor reinitialize |
|
313 | 1244 |
|
1245 |
"Modified: 13.12.1995 / 13:45:35 / stefan" |
|
90 | 1246 |
! ! |
1247 |
||
19 | 1248 |
!WindowGroup methodsFor:'printing'! |
1249 |
||
90 | 1250 |
printOn:aStream |
19 | 1251 |
"return a printed representation; |
144 | 1252 |
just for more user friendlyness: add name of process." |
19 | 1253 |
|
90 | 1254 |
myProcess isNil ifTrue:[ |
1255 |
(previousGroup notNil and:[previousGroup process notNil]) ifTrue:[ |
|
1256 |
aStream nextPutAll:('WindowGroup(modal in ' , previousGroup process nameOrId , ')'). |
|
1257 |
^ self. |
|
1258 |
]. |
|
1259 |
^ super printOn:aStream |
|
1260 |
]. |
|
1261 |
aStream nextPutAll:('WindowGroup(' , myProcess nameOrId , ')') |
|
19 | 1262 |
! ! |
244 | 1263 |
|
1264 |
!WindowGroup methodsFor:'special'! |
|
1265 |
||
1266 |
restoreCursors |
|
1267 |
"restore the original cursors in all of my views" |
|
1268 |
||
330
13a3fa93330c
careful - view could have been destroyed in the meanwhile (in restoreCursors)
Claus Gittinger <cg@exept.de>
parents:
329
diff
changeset
|
1269 |
self allViewsDo:[:aView | |
743 | 1270 |
|c dev id cid| |
244 | 1271 |
|
743 | 1272 |
dev := aView graphicsDevice. |
1273 |
dev notNil ifTrue:[ |
|
1274 |
(id := aView id) notNil ifTrue:[ |
|
1275 |
c := aView cursor on:dev. |
|
1276 |
(cid := c id) notNil ifTrue:[ |
|
1277 |
dev setCursor:cid in:id. |
|
1278 |
] |
|
1279 |
] |
|
1280 |
] |
|
244 | 1281 |
]. |
743 | 1282 |
|
1283 |
"Modified: 28.5.1996 / 20:27:14 / cg" |
|
244 | 1284 |
! |
1285 |
||
328 | 1286 |
showActivity:someMessage |
597 | 1287 |
"some activityNotification shalt be communicated to |
1288 |
the user; |
|
1289 |
forward it to my first topView if there is one |
|
1290 |
(that one should know how to deal with it)" |
|
1291 |
||
328 | 1292 |
topViews notNil ifTrue:[ |
597 | 1293 |
topViews first showActivity:someMessage |
328 | 1294 |
] |
1295 |
||
1296 |
"Created: 16.12.1995 / 18:39:40 / cg" |
|
597 | 1297 |
"Modified: 23.4.1996 / 21:36:54 / cg" |
328 | 1298 |
! |
1299 |
||
244 | 1300 |
showCursor:aCursor |
1301 |
"change the cursor to aCursor in all of my views." |
|
1302 |
||
406 | 1303 |
|c id dev| |
244 | 1304 |
|
1305 |
c := aCursor. |
|
1306 |
self allViewsDo:[:aView | |
|
743 | 1307 |
c := c on:(dev := aView graphicsDevice). |
1308 |
(id := c id) notNil ifTrue:[ |
|
1309 |
dev setCursor:id in:aView id. |
|
1310 |
] |
|
244 | 1311 |
]. |
743 | 1312 |
|
1313 |
"Modified: 28.5.1996 / 20:27:17 / cg" |
|
244 | 1314 |
! |
1315 |
||
1316 |
withCursor:aCursor do:aBlock |
|
1317 |
"evaluate aBlock while showing aCursor in all |
|
1318 |
my views (used to show wait-cursor while doing something). |
|
1319 |
Return the result as returned by aBlock." |
|
1320 |
||
317
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
1321 |
|oldCursors dev| |
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
1322 |
|
926
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
1323 |
dev := self graphicsDevice. |
317
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
1324 |
dev isNil ifTrue:[ |
926
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
1325 |
^ aBlock value |
317
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
1326 |
]. |
244 | 1327 |
|
1328 |
" |
|
1329 |
get mapping of view->cursor for all of my subviews |
|
1330 |
" |
|
1331 |
oldCursors := IdentityDictionary new. |
|
1332 |
self allViewsDo:[:aView | |
|
926
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
1333 |
oldCursors at:aView put:(aView cursor). |
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
1334 |
aView cursor:aCursor now:false |
244 | 1335 |
]. |
329
8a34deadc4ff
sync (not flush) after a cursor change
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
1336 |
"/ |
8a34deadc4ff
sync (not flush) after a cursor change
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
1337 |
"/ here sync looks better; flush leads to almost invisible cursors when accepting. |
8a34deadc4ff
sync (not flush) after a cursor change
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
1338 |
"/ I dont really know why (maybe unix does not context-switch to the Xserver |
8a34deadc4ff
sync (not flush) after a cursor change
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
1339 |
"/ early enough after the requests have been sent ?) |
8a34deadc4ff
sync (not flush) after a cursor change
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
1340 |
"/ |
8a34deadc4ff
sync (not flush) after a cursor change
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
1341 |
"/ dev flush. |
8a34deadc4ff
sync (not flush) after a cursor change
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
1342 |
dev sync. |
244 | 1343 |
|
1344 |
^ aBlock valueNowOrOnUnwindDo:[ |
|
926
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
1345 |
" |
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
1346 |
restore cursors from the mapping |
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
1347 |
" |
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
1348 |
oldCursors keysAndValuesDo:[:view :cursor | |
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
1349 |
view cursor:cursor now:false. |
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
1350 |
]. |
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
1351 |
dev flush "/ sync. |
244 | 1352 |
] |
317
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
1353 |
|
926
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
1354 |
"Modified: 5.7.1996 / 17:54:16 / cg" |
408 | 1355 |
! |
1356 |
||
1357 |
withWaitCursorDo:aBlock |
|
1358 |
"evaluate aBlock while showing a waitCursor in all |
|
1359 |
my views (used to show wait-cursor while doing something time consuming). |
|
1360 |
Return the result as returned by aBlock." |
|
1361 |
||
1362 |
^ self withCursor:(Cursor wait) do:aBlock |
|
1363 |
||
1364 |
"Created: 6.2.1996 / 19:51:53 / cg" |
|
244 | 1365 |
! ! |
1366 |
||
1367 |
!WindowGroup methodsFor:'special accessing'! |
|
1368 |
||
429 | 1369 |
isForModalSubview |
1370 |
"special for windowgroups for modal subviews. |
|
1371 |
These must be flagged specially to avoid the views being reassigned |
|
1372 |
to the maingroup. |
|
1373 |
This is a private interface to the SimpleView class" |
|
1374 |
||
1375 |
^ isForModalSubview |
|
1376 |
! |
|
1377 |
||
1378 |
isForModalSubview:aBoolean |
|
1379 |
"special for windowgroups for modal subviews. |
|
1380 |
These must be flagged specially to avoid the views being reassigned |
|
1381 |
to the maingroup. |
|
1382 |
This is a private interface to the SimpleView class" |
|
1383 |
||
1384 |
isForModalSubview := aBoolean |
|
1385 |
! |
|
1386 |
||
244 | 1387 |
setModal:aBoolean |
1388 |
"special entry for debugger: set the modal flag. |
|
1389 |
Not for public use" |
|
1390 |
||
1391 |
isModal := aBoolean |
|
1392 |
||
1393 |
"Modified: 3.9.1995 / 14:51:04 / claus" |
|
1394 |
! |
|
1395 |
||
1396 |
setPreviousGroup:aGroup |
|
1397 |
"special entry for debugger: |
|
1398 |
set the windowgroup that started this group (for modal groups only). |
|
1399 |
This is not a public interface." |
|
1400 |
||
1401 |
previousGroup := aGroup |
|
1402 |
||
1403 |
"Modified: 3.9.1995 / 14:55:40 / claus" |
|
1404 |
! |
|
1405 |
||
1406 |
setProcess:aProcess |
|
1407 |
"special entry for debugger: set the windowGroups process. |
|
1408 |
Not for public use." |
|
1409 |
||
1410 |
myProcess := aProcess |
|
1411 |
||
1412 |
"Modified: 3.9.1995 / 14:25:38 / claus" |
|
1413 |
! ! |
|
1414 |
||
1110 | 1415 |
!WindowGroup class methodsFor:'documentation'! |
251 | 1416 |
|
1417 |
version |
|
1111 | 1418 |
^ '$Header: /cvs/stx/stx/libview/WindowGroup.st,v 1.90 1996-11-09 16:01:12 cg Exp $' |
251 | 1419 |
! ! |
244 | 1420 |
WindowGroup initialize! |