author | Claus Gittinger <cg@exept.de> |
Wed, 03 Apr 2019 22:06:20 +0200 | |
changeset 8672 | f17d3237e820 |
parent 8506 | 04df120d795f |
child 8677 | 8e63719d8dfe |
permissions | -rw-r--r-- |
8502 | 1 |
"{ Encoding: utf8 }" |
2 |
||
26 | 3 |
" |
4 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
72 | 5 |
All Rights Reserved |
26 | 6 |
|
7 |
This software is furnished under a license and may be used |
|
8 |
only in accordance with the terms of that license and with the |
|
9 |
inclusion of the above copyright notice. This software may not |
|
10 |
be provided or otherwise made available to, or used by, any |
|
11 |
other person. No title to or ownership of the software is |
|
12 |
hereby transferred. |
|
13 |
" |
|
3212 | 14 |
"{ Package: 'stx:libview' }" |
15 |
||
6742 | 16 |
"{ NameSpace: Smalltalk }" |
17 |
||
11 | 18 |
Object subclass:#WindowGroup |
2857
b9bff260f854
cache graphicsDevice - its called often
Claus Gittinger <cg@exept.de>
parents:
2851
diff
changeset
|
19 |
instanceVariableNames:'graphicsDevice views topViews myProcess mySensor isModal |
b9bff260f854
cache graphicsDevice - its called often
Claus Gittinger <cg@exept.de>
parents:
2851
diff
changeset
|
20 |
previousGroup focusView focusSequence preEventHook postEventHook |
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
21 |
pointerView isForModalSubview focusByTab groupHasFocus busyHook |
6120 | 22 |
busyHookTimeout inModalLoop isDebugged preEventHooks |
23 |
postEventHooks creatingProcess traceEvents processPriority |
|
7676 | 24 |
inWithCursorDoBlock doNotCloseOnAbortSignal previousFocusView |
8421 | 25 |
modalGroup controlInterruptHandler haltInterruptHandler' |
8330 | 26 |
classVariableNames:'LastActiveGroup LastActiveProcess LeaveSignal BusyHookTime' |
317
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
27 |
poolDictionaries:'' |
5276 | 28 |
category:'Interface-Support-UI' |
11 | 29 |
! |
30 |
||
5691 | 31 |
Query subclass:#LastEventQuery |
32 |
instanceVariableNames:'' |
|
33 |
classVariableNames:'' |
|
34 |
poolDictionaries:'' |
|
35 |
privateIn:WindowGroup |
|
36 |
! |
|
37 |
||
38 |
Query subclass:#WindowGroupQuery |
|
39 |
instanceVariableNames:'' |
|
40 |
classVariableNames:'' |
|
41 |
poolDictionaries:'' |
|
42 |
privateIn:WindowGroup |
|
43 |
! |
|
44 |
||
1110 | 45 |
!WindowGroup class methodsFor:'documentation'! |
46 | 46 |
|
47 |
copyright |
|
48 |
" |
|
49 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
72 | 50 |
All Rights Reserved |
46 | 51 |
|
52 |
This software is furnished under a license and may be used |
|
53 |
only in accordance with the terms of that license and with the |
|
54 |
inclusion of the above copyright notice. This software may not |
|
55 |
be provided or otherwise made available to, or used by, any |
|
56 |
other person. No title to or ownership of the software is |
|
57 |
hereby transferred. |
|
58 |
" |
|
59 |
! |
|
60 |
||
61 |
documentation |
|
62 |
" |
|
103 | 63 |
In Smalltalk/X, the known (ST-80) concept of a controller has been |
297 | 64 |
extended (split) into a WindowGroup which handles process related stuff, |
65 |
and the Controller, which only handles events for a view and defines the user interaction. |
|
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
66 |
The controller functionality might be (actually: often is) included in the view components. |
297 | 67 |
All interaction is via event queues - there is no polling in controllers (not even conceptionally). |
103 | 68 |
|
69 |
WindowGroups are responsible to wait for and forward events for a group of |
|
297 | 70 |
windows. All views in a windowGroup share a single windowSensor which holds the |
1503 | 71 |
event queue (therefore subviews all share the same input event queue). |
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
72 |
Actually, there are two separate event queues - one for damage and view-visibility-related events, |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
73 |
another one for user interaction (such as mouse, keyboard etc.) |
144 | 74 |
|
297 | 75 |
The event queues are filled with incoming events as arriving from the physical display. |
76 |
This is done by a separate process (so called event-dispatcher) which runs at a higher |
|
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
77 |
priority. The event dispatcher determines the queue into which an event has to be placed, |
7709 | 78 |
by asking the view for which the event is destined (via the view's sensor). |
79 |
There may be multiple event dispatchers running (to support multiple displays simultaneously), |
|
80 |
there may also be multiple input device readers running |
|
81 |
(to suppert tablet/pen input, or other input devices). |
|
82 |
See the documentation/examples in DeviceWorkstation/XWorkstation on how this is done. |
|
297 | 83 |
|
103 | 84 |
Except for modal boxes, a separate process is created for each windowGroup |
297 | 85 |
which waits for events to arrive and processes them, by sending corresponding |
7709 | 86 |
event messages to the view's controller or the view (*). |
297 | 87 |
The controller is determined by asking the view (for which the event is destined); |
88 |
if the returned controller is nil, the event is sent directly to the view. |
|
89 |
This allows for simple views to work without a controller. |
|
90 |
(all of this is actually done in a WindowEvent method) |
|
91 |
||
92 |
Therefore, multiple applications run pseudo parallel. |
|
93 |
Even if some window performs a long time computation, events are still received |
|
94 |
and entered into the corresponding event queues (because the event dispatcher process |
|
95 |
runs at a higher priority). However, the actual processing of the event is only |
|
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
96 |
possibly if no other process is busy at the same or a higher priority (unless timeslicing is enabled). |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
97 |
If timeslicing is off, it is possible to change a windowProcesses priority in order to give |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
98 |
other windows a chance to execute (some views do this while performing longtime actions). |
297 | 99 |
|
103 | 100 |
Modal boxes create an extra window group for the components of the modal |
297 | 101 |
box, but execute the event-processing loop for this new group in the original process - |
144 | 102 |
therefore, the original windowgroup is blocked for the duration of the modal |
297 | 103 |
interaction. |
104 |
However, the modal-event processing loop peeks into the original groups event queue |
|
105 |
from time to time, and handles expose events. Thus, even while blocked for user input, |
|
106 |
the original group continues to get update/redraw events. |
|
103 | 107 |
|
108 |
Normally, one windowgroup is associated to each topview (StandardSystemView) |
|
144 | 109 |
and all of its subviews. However, this is not strictly required; |
110 |
it is possible to create extra windowgroups for subviews, which will let them |
|
111 |
run in parallel |
|
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
112 |
(for example, the FileBrowsers kill-Button is created that |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
113 |
way, to allow a kill of an executing unix command, while the browser |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
114 |
itself reads the pipeStream for incoming text. |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
115 |
Even if the fileBrowser is busy reading the pipe, the killButton is still |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
116 |
working and allows terminating the pipe-read action). |
144 | 117 |
|
118 |
On the other hand, multiple topviews can be placed into the same windowGroup; |
|
119 |
which allows for multiview applications, of which only one communicates with |
|
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
120 |
the user at a time (for example: the GUI painters canvas and gallery are in the same group). |
7914 | 121 |
Multiple topviews within a windowGroup can be configured to behave like one |
297 | 122 |
unit with respect to iconification, deiconification and termination. |
123 |
This is done by creating multiple topViews in one group, and setting up a master/slave |
|
124 |
or partner relation among them (see TopView>>beSlave and TopView>>bePartner). |
|
103 | 125 |
|
109 | 126 |
WindowGroups also support a focus window: this is the one that gets the |
103 | 127 |
keyboard input - even if the cursor is located in another subview. |
512 | 128 |
The sequence is defined by the topView or its model (typically an applicationModel). |
129 |
It should return an orderedCollection of subviews when asked via #focusSequence. |
|
130 |
||
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
131 |
For debugging or special event manipulations, windowGroups allow for hooks to be installed |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
132 |
around the processing of events - preEventHook is sent a #procesEvent: message before an event is processed, |
512 | 133 |
postEventHook is informed after the event has been processed. |
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
134 |
The preEventHook should return a boolean - if it returns true, the event is considered |
512 | 135 |
being already processed by the hook and ignored. |
136 |
This allows for event-tracing, timing or even filtering (if preEventHook returns true). |
|
137 |
(notice: there is also an eventHook facility available in the sensor class.) |
|
103 | 138 |
|
139 |
Finally, windowgroups are the perfect place for things like defining a |
|
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
140 |
cursor for all associated views, flushing all input, waiting for expose events etc. |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
141 |
|
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
142 |
Late News: |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
143 |
a busyHook and busyHookTimeout has been added; this hook-(block) gets invoked, whenever |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
144 |
the process was busy handling an event for some time. This can be used to automatically install |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
145 |
a busy cursor (hour-glass) in an application, if some processing takes some time |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
146 |
(without a need for #withCursorDo: all over the place in the application) |
103 | 147 |
|
7665 | 148 |
Don't get confused: |
149 |
You don't have to care for all those details in the normal case; |
|
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
150 |
a windowgroup is created for you automatically, when a view is opened. |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
151 |
All of the internals are not required to be known for most applications. |
297 | 152 |
|
103 | 153 |
|
597 | 154 |
[instance variables:] |
144 | 155 |
|
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
156 |
views collection of views of this group |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
157 |
|
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
158 |
topViews collection of topviews of this group |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
159 |
|
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
160 |
myProcess the process executing the events |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
161 |
|
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
162 |
mySensor my input sensor |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
163 |
|
6120 | 164 |
isModal true if this is for a modal box; i.e. running a separate |
165 |
modal event loop on top of another window group. |
|
7676 | 166 |
Those modal groups execute in the same process as the underlying group |
6120 | 167 |
|
168 |
inModalLoop true if this group's event processing is currently suspended |
|
169 |
because I have opened a modal window (with its own 'isModal' |
|
170 |
group) which handles events for a while. |
|
171 |
||
7676 | 172 |
modalGroup non-nil windowGroup which is my modal windowGroup, if I am |
173 |
in a modal loop. I.e. the group which has been started by me and |
|
174 |
which has taken control. |
|
175 |
||
176 |
previousGroup if modal, the group that started this one (might be another modal one) |
|
177 |
||
6120 | 178 |
isDebugged true if a debugger sits on top of me |
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
179 |
|
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
180 |
focusView the one that has the keyboard focus (or nil) |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
181 |
|
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
182 |
focusByTab if focus came via tabbing |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
183 |
(as opposed to an implicit focus change) |
2485
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
184 |
|
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
185 |
focusSequence defines the focus sequence |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
186 |
|
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
187 |
preEventHook if non-nil, that one gets notified of incoming |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
188 |
events BEFORE an event is dispatched. |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
189 |
May eat events (i.e. suppress dispatch) |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
190 |
(hook for event filters or recorders) |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
191 |
|
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
192 |
postEventHook if non-nil, that one gets notified |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
193 |
AFTER an event was dispatched. |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
194 |
|
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
195 |
isForModalSubView |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
196 |
|
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
197 |
groupHasFocus true, if this windowGroup has the focus |
2506 | 198 |
|
103 | 199 |
|
597 | 200 |
[class variables:] |
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
201 |
LeaveSignal if raised, a modal box leaves (closes) |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
202 |
|
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
203 |
WindowGroupQuerySignal to ask for the current windowGroup, |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
204 |
anywhere in the program, simply raise this |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
205 |
signal. The raise returns nil, for processes, |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
206 |
which are not under control of a windowGroup. |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
207 |
(i.e. wg := WindowGroup windowGroupQuerySignal raise) |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
208 |
|
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
209 |
LastEventQuerySignal to ask for the event which was responsible |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
210 |
for being where you are (whereever that is). |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
211 |
The raise returns nil, if you did not arrive |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
212 |
there due to an event. |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
213 |
(i.e. ev := WindowGroup lastEventQuerySignal raise) |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
214 |
The event can be asked for the view, the type |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
215 |
of event, x/y position etc. |
2506 | 216 |
|
217 |
||
144 | 218 |
(*) |
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
219 |
due to historic reasons, many views have the controller functionality |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
220 |
integrated, and handle events themself. The windowSensor takes care |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
221 |
of this, by checking if a view has a controller, and, if so, forwarding |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
222 |
the events to it. Otherwise, events are sent directly to the view. |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
223 |
|
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
224 |
In the future, all views will be rewritten to actually use a controller. |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
225 |
Currently (being in the middle of this migration), only some views |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
226 |
(buttons, toggles and subclasses) do so. |
144 | 227 |
|
103 | 228 |
For more information, read 'introduction to view programming' in the |
229 |
doc/online directory. |
|
597 | 230 |
|
612 | 231 |
[author:] |
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
232 |
Claus Gittinger |
612 | 233 |
|
597 | 234 |
[see also:] |
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
235 |
WindowSensor WindowEvent EventListener KeyboardForwarder |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
236 |
DeviceWorkstation |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
237 |
View StandardSystemView |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
238 |
ApplicationModel |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
239 |
Process ProcessorScheduler |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
240 |
(``Working with processes (programmers manual)'': programming/processes.html#VIEWSNPROCS) |
46 | 241 |
" |
242 |
! ! |
|
243 |
||
1110 | 244 |
!WindowGroup class methodsFor:'initialization'! |
46 | 245 |
|
246 |
initialize |
|
247 |
LeaveSignal isNil ifTrue:[ |
|
5691 | 248 |
LeaveSignal := (Signal new) mayProceed:true. |
249 |
LeaveSignal nameClass:self message:#leaveSignal. |
|
250 |
LeaveSignal notifierString:'unhandled leave signal'. |
|
251 |
||
8309 | 252 |
BusyHookTime := 150. "ms" |
54 | 253 |
]. |
46 | 254 |
|
255 |
"WindowGroup initialize" |
|
956
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
256 |
|
5691 | 257 |
"Modified: / 27-01-2011 / 18:14:34 / cg" |
8330 | 258 |
"Modified: / 11-04-2018 / 11:24:31 / stefan" |
46 | 259 |
! ! |
260 |
||
1110 | 261 |
!WindowGroup class methodsFor:'instance creation'! |
244 | 262 |
|
263 |
new |
|
264 |
"create and return a new WindowGroup object" |
|
265 |
||
266 |
^ self basicNew initialize |
|
267 |
! ! |
|
268 |
||
1110 | 269 |
!WindowGroup class methodsFor:'Signal constants'! |
270 |
||
271 |
lastEventQuerySignal |
|
272 |
"return the signal which is used to query for the last event" |
|
273 |
||
8330 | 274 |
^ LastEventQuery |
275 |
||
276 |
"Created: / 17-07-1996 / 20:36:04 / cg" |
|
277 |
"Modified: / 11-04-2018 / 11:20:49 / stefan" |
|
1110 | 278 |
! |
72 | 279 |
|
280 |
leaveSignal |
|
109 | 281 |
"return the signal which is used to exit a modal loop. |
1752 | 282 |
This private signal, is always caught while a modalbox is active. |
7709 | 283 |
Raising it will exit the modal loop and return from the view's #openModal |
144 | 284 |
method." |
109 | 285 |
|
72 | 286 |
^ LeaveSignal |
956
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 |
windowGroupQuerySignal |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
290 |
"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
|
291 |
|
8330 | 292 |
^ WindowGroupQuery |
293 |
||
294 |
"Created: / 17-07-1996 / 20:36:04 / cg" |
|
295 |
"Modified: / 11-04-2018 / 11:23:31 / stefan" |
|
72 | 296 |
! ! |
297 |
||
1110 | 298 |
!WindowGroup class methodsFor:'accessing'! |
26 | 299 |
|
3172
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
300 |
activeApplication |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
301 |
"return the currently active application. |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
302 |
Notice: this may be a modal dialogs application - i.e. it is not |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
303 |
always the main application." |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
304 |
|
3751 | 305 |
|activeGroup| |
3172
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
306 |
|
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
307 |
(activeGroup := self activeGroup) notNil ifTrue:[ |
3751 | 308 |
^ activeGroup application |
3173
1947c87324d5
oops - the active* queries should return nil sometimes
Claus Gittinger <cg@exept.de>
parents:
3172
diff
changeset
|
309 |
]. |
1947c87324d5
oops - the active* queries should return nil sometimes
Claus Gittinger <cg@exept.de>
parents:
3172
diff
changeset
|
310 |
^ nil |
3172
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
311 |
|
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
312 |
" |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
313 |
WindowGroup activeApplication |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
314 |
" |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
315 |
! |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
316 |
|
26 | 317 |
activeGroup |
180 | 318 |
"return the currently active windowGroup. |
319 |
The returned value may not be fully correct, in case the current process |
|
1298
d070db2e4530
always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents:
1273
diff
changeset
|
320 |
handles multiple windowGroups simultaneously. In this case, |
d070db2e4530
always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents:
1273
diff
changeset
|
321 |
(usually) the first group is returned (prefering a modal if there is one). |
180 | 322 |
(maybe we should return a collection of windowGroups here). |
323 |
||
324 |
This method is required to simulate the historic ST-80 single display |
|
325 |
behavior for Cursor>>show / Cursor>>showWhile and some others (raising the |
|
326 |
activeGroups topView when modalBoxes appear) on multiple display screens. |
|
327 |
These methods should change the cursor for the currently |
|
328 |
active windowGroup ONLY, instead of globally affecting the display or |
|
329 |
all views |
|
330 |
(since, depending on the priority, other views could be unaffacted by this |
|
331 |
and an overall cursor change does not make sense.)" |
|
332 |
||
333 |
|activeProcess groups wg| |
|
334 |
||
335 |
Processor isNil ifTrue:[^ nil]. "/ only during very early init phase |
|
26 | 336 |
|
180 | 337 |
activeProcess := Processor activeProcess. |
338 |
" caching the last value ..." |
|
565
6867f1a9a470
oops - leftover global LastActive
Claus Gittinger <cg@exept.de>
parents:
513
diff
changeset
|
339 |
activeProcess == LastActiveProcess ifTrue:[ |
3541
7909bbc0bf42
oops (care for nil LastGroup)
Claus Gittinger <cg@exept.de>
parents:
3538
diff
changeset
|
340 |
(LastActiveGroup notNil |
5260
8ce66f3e7141
care to ignore cached last activeGroup, if it has already closed its views.
Claus Gittinger <cg@exept.de>
parents:
5215
diff
changeset
|
341 |
and:[LastActiveGroup process == LastActiveProcess |
8ce66f3e7141
care to ignore cached last activeGroup, if it has already closed its views.
Claus Gittinger <cg@exept.de>
parents:
5215
diff
changeset
|
342 |
and:[LastActiveGroup views notEmptyOrNil ]]) ifTrue:[ |
3212 | 343 |
^ LastActiveGroup |
344 |
] |
|
180 | 345 |
]. |
1298
d070db2e4530
always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents:
1273
diff
changeset
|
346 |
|
8330 | 347 |
WindowGroupQuery isNil ifTrue:[^ nil]. "/ only during very early init phase |
348 |
wg := WindowGroupQuery query. |
|
956
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
349 |
|
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
350 |
wg isNil ifTrue:[ |
3212 | 351 |
"/ mhmh - noone willing to answer that question ... |
352 |
"/ (how can this happen ?) |
|
353 |
groups := self scheduledWindowGroups |
|
354 |
select:[:wg | wg process == activeProcess]. |
|
3619 | 355 |
groups notEmpty ifTrue:[ |
356 |
wg := groups detect:[:wg | wg isModal] ifNone:nil. |
|
357 |
wg isNil ifTrue:[ |
|
358 |
wg := groups anElement |
|
3212 | 359 |
] |
360 |
]. |
|
956
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
361 |
]. |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
362 |
|
180 | 363 |
wg notNil ifTrue:[ |
3212 | 364 |
LastActiveProcess := activeProcess. |
365 |
LastActiveGroup := wg. |
|
180 | 366 |
]. |
367 |
^ wg |
|
368 |
||
369 |
" |
|
370 |
WindowGroup activeGroup |
|
371 |
" |
|
372 |
||
8330 | 373 |
"Modified: / 03-09-1995 / 14:49:53 / claus" |
374 |
"Modified: / 17-04-1998 / 11:49:28 / cg" |
|
375 |
"Modified: / 11-04-2018 / 11:23:20 / stefan" |
|
54 | 376 |
! |
377 |
||
3172
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
378 |
activeMainApplication |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
379 |
"return the currently active main application. |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
380 |
Notice: |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
381 |
if invoked by a modal application, this returns the main (non-modal) |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
382 |
application." |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
383 |
|
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
384 |
|activeGroup mainView| |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
385 |
|
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
386 |
(activeGroup := self activeGroup) notNil ifTrue:[ |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
387 |
(mainView := activeGroup mainGroup mainView) notNil ifTrue:[ |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
388 |
^ mainView application |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
389 |
] |
3173
1947c87324d5
oops - the active* queries should return nil sometimes
Claus Gittinger <cg@exept.de>
parents:
3172
diff
changeset
|
390 |
]. |
1947c87324d5
oops - the active* queries should return nil sometimes
Claus Gittinger <cg@exept.de>
parents:
3172
diff
changeset
|
391 |
^ nil |
3172
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
392 |
|
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
393 |
" |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
394 |
WindowGroup activeMainApplication |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
395 |
" |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
396 |
|
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
397 |
! |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
398 |
|
8481 | 399 |
allTopViews |
400 |
|allWindowGroups allTopViews| |
|
401 |
||
402 |
allTopViews := OrderedCollection new. |
|
403 |
||
404 |
allWindowGroups := WindowGroup scheduledWindowGroups. |
|
405 |
allWindowGroups do:[:wg | |
|
406 |
wg notNil ifTrue:[ |
|
407 |
(wg process notNil |
|
408 |
or:[wg isModal and:[wg previousGroup notNil]]) ifTrue:[ |
|
409 |
(wg topViews ? #()) do:[:eachTopView | |
|
410 |
|element icon| |
|
411 |
||
412 |
(eachTopView id notNil) ifTrue:[ |
|
413 |
allTopViews add:eachTopView |
|
414 |
] |
|
415 |
] |
|
416 |
] |
|
417 |
] |
|
418 |
]. |
|
419 |
^ allTopViews |
|
420 |
||
421 |
"Created: / 23-09-2018 / 23:30:44 / Claus Gittinger" |
|
422 |
! |
|
423 |
||
7619 | 424 |
flushCachedActiveGroup |
425 |
self setActiveGroup:nil |
|
426 |
! |
|
427 |
||
8444 | 428 |
lastEvent |
429 |
"notice: this returns the thread-specific (i.e. windowGroup-specific) |
|
430 |
last event, by issuing a query signal. |
|
431 |
Every windowGroup-process will have its own last event returned here" |
|
432 |
||
433 |
^ (self lastEventQuerySignal query). |
|
434 |
||
435 |
"Created: / 09-08-2018 / 09:27:21 / Claus Gittinger" |
|
436 |
! |
|
437 |
||
54 | 438 |
scheduledWindowGroups |
180 | 439 |
"return a collection of all windowGroups (possibly for different |
6850 | 440 |
display devices) which are scheduled |
441 |
(i.e. which have a process running, handling events)." |
|
442 |
||
443 |
|set screens coll| |
|
180 | 444 |
|
445 |
screens := Screen allScreens. |
|
1869 | 446 |
screens size == 0 ifTrue:[^ #()]. |
180 | 447 |
|
448 |
set := IdentitySet new. |
|
6850 | 449 |
coll := OrderedCollection new. |
450 |
||
180 | 451 |
screens do:[:aDevice | |
6850 | 452 |
aDevice allViewsDo:[:aView | |
453 |
|wg| |
|
454 |
||
455 |
(wg := aView windowGroup) notNil ifTrue:[ |
|
7672 | 456 |
(wg process notNil and:[wg process isDead not]) ifTrue:[ |
6850 | 457 |
(set includes:wg) ifFalse:[ |
458 |
set add:wg. |
|
459 |
coll add:wg. |
|
460 |
]. |
|
461 |
] |
|
462 |
]. |
|
463 |
]. |
|
180 | 464 |
]. |
6850 | 465 |
^ coll asArray |
180 | 466 |
|
467 |
" |
|
468 |
WindowGroup scheduledWindowGroups |
|
469 |
" |
|
470 |
||
471 |
"Modified: 1.9.1995 / 13:43:09 / claus" |
|
1869 | 472 |
"Modified: 18.8.1997 / 18:44:29 / cg" |
244 | 473 |
! |
474 |
||
475 |
setActiveGroup:aGroup |
|
476 |
"set the currently active windowGroup. |
|
477 |
Temporary; do not use this interface, it will vanish." |
|
478 |
||
6123 | 479 |
aGroup isNil ifTrue:[ |
480 |
LastActiveProcess := LastActiveGroup := nil. |
|
481 |
] ifFalse:[ |
|
482 |
LastActiveProcess := Processor activeProcess. |
|
483 |
LastActiveGroup := aGroup |
|
484 |
]. |
|
485 |
||
486 |
"Modified: / 29-08-2013 / 14:49:11 / cg" |
|
26 | 487 |
! ! |
488 |
||
2723 | 489 |
!WindowGroup class methodsFor:'focus control support'! |
490 |
||
491 |
takeFocusFromDevice:aDevice |
|
4341 | 492 |
|prevFocusView prevFocusGroup prevFocusCameViaTab| |
2723 | 493 |
|
494 |
"/ |
|
495 |
"/ take the focus from whichEver view had it previously |
|
496 |
"/ |
|
497 |
prevFocusView := aDevice focusView. |
|
498 |
prevFocusView notNil ifTrue:[ |
|
4676 | 499 |
aDevice focusView:nil. |
500 |
(prevFocusGroup := prevFocusView windowGroup) notNil ifTrue:[ |
|
3376 | 501 |
prevFocusCameViaTab := prevFocusGroup focusCameByTab. |
502 |
||
503 |
prevFocusView showNoFocus:prevFocusCameViaTab. "/ true is bad - see pullDownMenu. |
|
504 |
self sendKeyboardFocusEventTo:prevFocusView withArgument:false. |
|
505 |
]. |
|
2723 | 506 |
]. |
4676 | 507 |
|
508 |
"Modified: / 08-11-2006 / 12:05:22 / cg" |
|
2723 | 509 |
! ! |
510 |
||
3376 | 511 |
!WindowGroup class methodsFor:'others'! |
512 |
||
513 |
sendKeyboardFocusEventTo:aView withArgument:arg |
|
8331 | 514 |
|sensor| |
515 |
||
516 |
aView isNil ifTrue:[ |
|
517 |
^ self |
|
518 |
]. |
|
3376 | 519 |
|
520 |
(sensor := aView sensor) notNil ifTrue:[ |
|
8331 | 521 |
sensor pushEvent:(WindowEvent keyboardFocus:arg view:aView). |
3376 | 522 |
] ifFalse:[ |
523 |
aView hasKeyboardFocus:arg |
|
524 |
]. |
|
8331 | 525 |
|
526 |
"Modified (format): / 11-04-2018 / 14:27:50 / stefan" |
|
3376 | 527 |
! ! |
528 |
||
11 | 529 |
!WindowGroup methodsFor:'accessing'! |
530 |
||
3780
69a0a7142c48
remember process which created a modal group,
Claus Gittinger <cg@exept.de>
parents:
3777
diff
changeset
|
531 |
creatingProcess |
69a0a7142c48
remember process which created a modal group,
Claus Gittinger <cg@exept.de>
parents:
3777
diff
changeset
|
532 |
"return the process which created this group or nil. |
69a0a7142c48
remember process which created a modal group,
Claus Gittinger <cg@exept.de>
parents:
3777
diff
changeset
|
533 |
Only returns non-nil for modal groups." |
69a0a7142c48
remember process which created a modal group,
Claus Gittinger <cg@exept.de>
parents:
3777
diff
changeset
|
534 |
|
69a0a7142c48
remember process which created a modal group,
Claus Gittinger <cg@exept.de>
parents:
3777
diff
changeset
|
535 |
^ creatingProcess |
69a0a7142c48
remember process which created a modal group,
Claus Gittinger <cg@exept.de>
parents:
3777
diff
changeset
|
536 |
|
69a0a7142c48
remember process which created a modal group,
Claus Gittinger <cg@exept.de>
parents:
3777
diff
changeset
|
537 |
"Modified: / 17.8.1998 / 10:21:29 / cg" |
69a0a7142c48
remember process which created a modal group,
Claus Gittinger <cg@exept.de>
parents:
3777
diff
changeset
|
538 |
! |
69a0a7142c48
remember process which created a modal group,
Claus Gittinger <cg@exept.de>
parents:
3777
diff
changeset
|
539 |
|
512 | 540 |
device |
541 |
"return the device, we receive our events from" |
|
542 |
||
3436 | 543 |
<resource:#obsolete> |
544 |
||
926
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
545 |
self obsoleteMethodWarning:'use #graphicsDevice'. |
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
546 |
^ self graphicsDevice |
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
547 |
|
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
548 |
"Modified: 5.7.1996 / 17:53:58 / cg" |
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
549 |
! |
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
550 |
|
5288 | 551 |
doNotCloseOnAbortSignal:something |
552 |
"normally, an abortSignal closes a modal dialog, which is different from a non-modal |
|
553 |
one, where only the current action (event handling) is aborted. |
|
554 |
||
555 |
This can be disabled, if you want to avoid closing a modal application, |
|
556 |
but instead have the same non-modal behavior for modal app vies" |
|
557 |
||
558 |
doNotCloseOnAbortSignal := something. |
|
559 |
! |
|
560 |
||
926
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
561 |
graphicsDevice |
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
562 |
"return the device, we receive our events from" |
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
563 |
|
1311
0746d3fe9a62
changed (fixed ?) graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
1304
diff
changeset
|
564 |
|dev| |
0746d3fe9a62
changed (fixed ?) graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
1304
diff
changeset
|
565 |
|
2857
b9bff260f854
cache graphicsDevice - its called often
Claus Gittinger <cg@exept.de>
parents:
2851
diff
changeset
|
566 |
graphicsDevice notNil ifTrue:[^ graphicsDevice]. |
b9bff260f854
cache graphicsDevice - its called often
Claus Gittinger <cg@exept.de>
parents:
2851
diff
changeset
|
567 |
|
1311
0746d3fe9a62
changed (fixed ?) graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
1304
diff
changeset
|
568 |
topViews notNil ifTrue:[ |
3077 | 569 |
topViews do:[:v | |
570 |
|app| |
|
1116 | 571 |
|
3077 | 572 |
v notNil ifTrue:[ |
573 |
(app := v application) notNil ifTrue:[ |
|
574 |
"/ |
|
575 |
"/ ok, it has an application; |
|
576 |
"/ ask it for preferences. |
|
577 |
"/ |
|
578 |
(dev := app graphicsDevice) notNil ifTrue:[ |
|
579 |
^ (graphicsDevice := dev) |
|
580 |
] |
|
581 |
]. |
|
582 |
(dev := v graphicsDevice) notNil ifTrue:[ |
|
583 |
^ (graphicsDevice := dev) |
|
584 |
] |
|
585 |
] |
|
586 |
] |
|
512 | 587 |
]. |
1311
0746d3fe9a62
changed (fixed ?) graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
1304
diff
changeset
|
588 |
views notNil ifTrue:[ |
3077 | 589 |
views do:[:v | |
590 |
v notNil ifTrue:[ |
|
591 |
(dev := v graphicsDevice) notNil ifTrue:[ |
|
592 |
^ (graphicsDevice := dev) |
|
593 |
] |
|
594 |
] |
|
595 |
] |
|
2170
44b86a4cc0d5
in #graphicsDevice: if there are no views, ask previousGroup if there is one.
Claus Gittinger <cg@exept.de>
parents:
2168
diff
changeset
|
596 |
]. |
44b86a4cc0d5
in #graphicsDevice: if there are no views, ask previousGroup if there is one.
Claus Gittinger <cg@exept.de>
parents:
2168
diff
changeset
|
597 |
"/ ask the previousGroup; I could be a popUp-views group, |
44b86a4cc0d5
in #graphicsDevice: if there are no views, ask previousGroup if there is one.
Claus Gittinger <cg@exept.de>
parents:
2168
diff
changeset
|
598 |
"/ which has already closed its views (and is performing its action) |
44b86a4cc0d5
in #graphicsDevice: if there are no views, ask previousGroup if there is one.
Claus Gittinger <cg@exept.de>
parents:
2168
diff
changeset
|
599 |
previousGroup notNil ifTrue:[ |
3077 | 600 |
^ previousGroup graphicsDevice |
512 | 601 |
]. |
602 |
^ nil |
|
603 |
||
2170
44b86a4cc0d5
in #graphicsDevice: if there are no views, ask previousGroup if there is one.
Claus Gittinger <cg@exept.de>
parents:
2168
diff
changeset
|
604 |
"Modified: / 9.7.1998 / 18:18:08 / cg" |
512 | 605 |
! |
606 |
||
6120 | 607 |
isDebugged |
608 |
"return true, if the receiver has a debugger sitting on top of me, |
|
609 |
so I do not have control" |
|
610 |
||
611 |
^ isDebugged ? false |
|
612 |
||
613 |
"Created: / 28-08-2013 / 21:51:33 / cg" |
|
614 |
! |
|
615 |
||
616 |
isDebugged:aBoolean |
|
617 |
"only set by the debugger to mark the currently active group as being debugged" |
|
618 |
||
619 |
isDebugged := aBoolean |
|
620 |
||
621 |
"Created: / 28-08-2013 / 21:52:35 / cg" |
|
622 |
! |
|
623 |
||
3737 | 624 |
isInModalLoop |
625 |
"return true, if the receiver has given up control to some other modal windowGroup |
|
626 |
(i.e. if it has popped up a modal dialog or a popUpMenu)" |
|
627 |
||
7676 | 628 |
"/ ^ modalGroup notNil. |
3737 | 629 |
^ inModalLoop ? false |
7676 | 630 |
|
631 |
"Modified: / 13-11-2016 / 22:59:29 / cg" |
|
3737 | 632 |
! |
633 |
||
512 | 634 |
isModal |
3737 | 635 |
"return true, if the receiver is for a modal view |
636 |
(i.e. it is for a modal box, dialog or popUpMenu). |
|
637 |
The suspended windowgroup would return true to the isInModalLoop query if this is the case." |
|
512 | 638 |
|
639 |
^ isModal |
|
640 |
||
641 |
"Modified: 7.3.1996 / 14:29:46 / cg" |
|
642 |
! |
|
643 |
||
644 |
mainGroup |
|
645 |
"return the main windowgroup (for modal groups only) |
|
646 |
that is the top one, which is not modal. |
|
647 |
NonModal groups return themSelf. |
|
648 |
||
649 |
There is one exception to this: the debugger (which is sort of modal) |
|
650 |
returns itself as mainGroup (not its debuggee)." |
|
651 |
||
652 |
|g prev| |
|
653 |
||
654 |
g := self. |
|
6364 | 655 |
[(g isModal or:[g isPopUp]) |
656 |
and:[(prev := g previousGroup) notNil]] whileTrue:[ |
|
7633 | 657 |
g == prev ifTrue:[^ g]. |
3354 | 658 |
g := prev |
512 | 659 |
]. |
660 |
^ g |
|
661 |
||
662 |
"Modified: 3.9.1995 / 14:57:20 / claus" |
|
663 |
"Modified: 7.3.1996 / 14:29:28 / cg" |
|
664 |
! |
|
665 |
||
1876
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
666 |
mainGroup:aWindowGroup |
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
667 |
"set the main windowgroup (for modal/autonomous groups only) |
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
668 |
Exposeevents for that windowGroup will be handled by this group |
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
669 |
as well." |
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
670 |
|
6118 | 671 |
self assert:(aWindowGroup ~~ self). |
1876
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
672 |
previousGroup := aWindowGroup |
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
673 |
|
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
674 |
"Created: 20.8.1997 / 17:57:35 / cg" |
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
675 |
! |
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
676 |
|
7678 | 677 |
modalGroup |
678 |
"if the receiver has given up control to some other modal windowGroup |
|
679 |
(i.e. if it has popped up a modal dialog or a popUpMenu), this is the modelGroup" |
|
680 |
||
681 |
^ modalGroup |
|
682 |
||
683 |
"Modified (comment): / 15-11-2016 / 00:13:47 / cg" |
|
684 |
! |
|
685 |
||
512 | 686 |
previousGroup |
687 |
"return the windowgroup that started this group. (for modal groups only). |
|
688 |
This may be another modalGroup (for boxes opened by boxes). |
|
689 |
NonModal groups return nil." |
|
690 |
||
691 |
^ previousGroup |
|
692 |
||
693 |
"Modified: 7.3.1996 / 14:28:46 / cg" |
|
694 |
! |
|
695 |
||
696 |
process |
|
697 |
"return the windowGroups process" |
|
698 |
||
2250
281f9fafdbe0
follow parentGroup in #process-query
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
699 |
myProcess isNil ifTrue:[ |
2363
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
700 |
previousGroup notNil ifTrue:[ |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
701 |
^ previousGroup process |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
702 |
] |
2250
281f9fafdbe0
follow parentGroup in #process-query
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
703 |
]. |
512 | 704 |
^ myProcess |
2250
281f9fafdbe0
follow parentGroup in #process-query
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
705 |
|
281f9fafdbe0
follow parentGroup in #process-query
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
706 |
"Modified: / 17.8.1998 / 10:21:29 / cg" |
512 | 707 |
! |
708 |
||
4375
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
709 |
processPriority |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
710 |
^ processPriority |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
711 |
! |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
712 |
|
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
713 |
processPriority:anInteger |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
714 |
processPriority := anInteger. |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
715 |
myProcess notNil ifTrue:[ |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
716 |
myProcess priority:anInteger. |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
717 |
]. |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
718 |
! |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
719 |
|
512 | 720 |
sensor |
5911 | 721 |
"return the windowGroup's sensor. |
722 |
All events for any of the group's views is handled by that sensor." |
|
512 | 723 |
|
724 |
^ mySensor |
|
725 |
||
5911 | 726 |
"Modified: / 07-03-1996 / 14:30:21 / cg" |
727 |
"Modified (comment): / 27-04-2012 / 13:55:53 / cg" |
|
512 | 728 |
! |
729 |
||
730 |
sensor:aSensor |
|
8506 | 731 |
"set the windowGroup's sensor" |
732 |
||
512 | 733 |
mySensor := aSensor |
734 |
! ! |
|
735 |
||
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
736 |
!WindowGroup methodsFor:'accessing-hooks'! |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
737 |
|
3511
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
738 |
addPostEventHook:anEventProcessor |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
739 |
"add another postEventHook" |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
740 |
|
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
741 |
postEventHooks isNil ifTrue:[ |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
742 |
postEventHooks := OrderedCollection new. |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
743 |
]. |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
744 |
(postEventHooks includesIdentical:anEventProcessor) ifFalse:[ |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
745 |
postEventHooks add:anEventProcessor |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
746 |
]. |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
747 |
! |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
748 |
|
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
749 |
addPreEventHook:anEventProcessor |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
750 |
"add another preEventHook" |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
751 |
|
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
752 |
preEventHooks isNil ifTrue:[ |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
753 |
preEventHooks := OrderedCollection new. |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
754 |
]. |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
755 |
(preEventHooks includesIdentical:anEventProcessor) ifFalse:[ |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
756 |
preEventHooks add:anEventProcessor |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
757 |
]. |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
758 |
! |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
759 |
|
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
760 |
busyHook |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
761 |
"return the busyHook if any" |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
762 |
|
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
763 |
^ busyHook |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
764 |
! |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
765 |
|
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
766 |
busyHook:anObject |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
767 |
"set the busyHook - this one will be invoked when the event-handling action |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
768 |
takes some time." |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
769 |
|
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
770 |
busyHook := anObject |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
771 |
! |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
772 |
|
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
773 |
busyHookTimeout |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
774 |
"return the busyHooks timeout if any" |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
775 |
|
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
776 |
^ busyHookTimeout |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
777 |
! |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
778 |
|
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
779 |
busyHookTimeout:anObject |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
780 |
"set the busyHooks timeout - the busyHook will be invoked when the event-handling action |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
781 |
takes longer than this time." |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
782 |
|
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
783 |
busyHookTimeout := anObject |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
784 |
! |
512 | 785 |
|
8421 | 786 |
haltInterruptHandler:aHandlerBlock |
8419 | 787 |
"can be used to intercept control interrupts |
788 |
(breakpoints and halts) on a per windowGroup base. |
|
789 |
If set, it gets called like an exception handler |
|
790 |
(i.e. with optional ex argument, which can be rejected, resumed, etc.)" |
|
791 |
||
8421 | 792 |
haltInterruptHandler := aHandlerBlock |
793 |
||
794 |
"Created: / 28-06-2018 / 15:16:06 / Claus Gittinger" |
|
8419 | 795 |
! |
796 |
||
512 | 797 |
postEventHook |
3786
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
798 |
"return the postEventHook if any. |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
799 |
That is a backwardCompatibility leftOver - no multiple hooks are supported." |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
800 |
|
4174 | 801 |
<resource:#obsolete> |
3786
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
802 |
self obsoleteMethodWarning:'use #postEventHooks'. |
512 | 803 |
^ postEventHook |
804 |
||
805 |
"Created: 7.3.1996 / 14:42:46 / cg" |
|
806 |
! |
|
807 |
||
808 |
postEventHook:anObject |
|
809 |
"set the postEventHook - this one will get all events |
|
3786
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
810 |
passed after being processed here (via #processEvent:). |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
811 |
That is a backwardCompatibility leftOver - no multiple hooks are supported." |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
812 |
|
4174 | 813 |
<resource:#obsolete> |
3786
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
814 |
self obsoleteMethodWarning:'use #addPostEventHook:/removePostEventHook:'. |
512 | 815 |
postEventHook := anObject |
816 |
! |
|
817 |
||
3786
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
818 |
postEventHooks |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
819 |
"return the postEventHooks if any" |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
820 |
|
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
821 |
^ postEventHooks |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
822 |
! |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
823 |
|
512 | 824 |
preEventHook |
3786
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
825 |
"return the preEventHook if any. |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
826 |
That is a backwardCompatibility leftOver - no multiple hooks are supported." |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
827 |
|
4174 | 828 |
<resource:#obsolete> |
3786
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
829 |
self obsoleteMethodWarning:'use #preEventHooks'. |
512 | 830 |
^ preEventHook |
831 |
||
832 |
"Created: 7.3.1996 / 14:42:42 / cg" |
|
833 |
! |
|
834 |
||
835 |
preEventHook:anObject |
|
836 |
"set the preEventHook - this one will get all events |
|
837 |
passed before being processed here (via #processEvent:). |
|
838 |
If this returns true, the event is supposed to be already |
|
839 |
processed and ignored here. |
|
3786
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
840 |
Otherwise, it is processed as usual. |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
841 |
That is a backwardCompatibility leftOver - no multiple hooks are supported." |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
842 |
|
4174 | 843 |
<resource:#obsolete> |
3786
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
844 |
self obsoleteMethodWarning:'use #addPreEventHook:/removePreEventHook:'. |
512 | 845 |
preEventHook := anObject |
3280 | 846 |
! |
847 |
||
3511
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
848 |
preEventHooks |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
849 |
"return the preEventHooks if any" |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
850 |
|
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
851 |
^ preEventHooks |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
852 |
|
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
853 |
"Created: 7.3.1996 / 14:42:42 / cg" |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
854 |
! |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
855 |
|
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
856 |
removePostEventHook:anEventProcessor |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
857 |
"remove a postEventHook" |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
858 |
|
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
859 |
postEventHooks notNil ifTrue:[ |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
860 |
postEventHooks removeIdentical:anEventProcessor ifAbsent:nil. |
6093 | 861 |
postEventHooks := postEventHooks asNilIfEmpty. |
3511
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
862 |
]. |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
863 |
! |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
864 |
|
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
865 |
removePreEventHook:anEventProcessor |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
866 |
"remove a preEventHook" |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
867 |
|
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
868 |
preEventHooks notNil ifTrue:[ |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
869 |
preEventHooks removeIdentical:anEventProcessor ifAbsent:nil. |
6097 | 870 |
preEventHooks := preEventHooks asNilIfEmpty. |
3511
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
871 |
]. |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
872 |
! |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
873 |
|
3280 | 874 |
showWaitCursorWhenBusyForMillis:millis |
875 |
"setup a busyHook, which automatically shows a waitCursor, |
|
876 |
whenever some action takes longer than millis" |
|
877 |
||
3288
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
878 |
self busyHookTimeout:millis. |
3280 | 879 |
self |
880 |
busyHook:[:isBusy | |
|
881 |
isBusy ifTrue:[ |
|
3281
95e6d0e98f92
care for modal dialogs in automatic busy cursor handling
Claus Gittinger <cg@exept.de>
parents:
3280
diff
changeset
|
882 |
self showCursor:(Cursor wait). |
4536 | 883 |
] ifFalse:[ |
3280 | 884 |
self restoreCursors |
885 |
] |
|
886 |
]. |
|
512 | 887 |
! ! |
888 |
||
889 |
!WindowGroup methodsFor:'accessing-views'! |
|
890 |
||
244 | 891 |
addTopView:aView |
892 |
"add a topview to the group" |
|
26 | 893 |
|
244 | 894 |
topViews isNil ifTrue:[ |
2723 | 895 |
topViews := OrderedCollection with:aView. |
2445 | 896 |
] ifFalse:[ |
2723 | 897 |
(topViews includesIdentical:aView) ifFalse:[ |
898 |
topViews add:aView |
|
899 |
] |
|
500
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
900 |
] |
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
901 |
|
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
902 |
"Modified: 6.3.1996 / 15:35:15 / cg" |
26 | 903 |
! |
904 |
||
11 | 905 |
addView:aView |
26 | 906 |
"add aView to the windowGroup" |
907 |
||
11 | 908 |
views isNil ifTrue:[ |
3151 | 909 |
views := OrderedCollection with:aView. |
2445 | 910 |
] ifFalse:[ |
3151 | 911 |
(views includesIdentical:aView) ifFalse:[ |
912 |
views add:aView |
|
913 |
] |
|
3156
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
914 |
] |
11 | 915 |
! |
916 |
||
3751 | 917 |
application |
918 |
|mainView| |
|
919 |
||
920 |
(mainView := self mainView) notNil ifTrue:[ |
|
921 |
^ mainView application |
|
922 |
]. |
|
923 |
^ nil |
|
924 |
! |
|
925 |
||
2445 | 926 |
mainView |
6849 | 927 |
"return the mainview. That's the first topView by default" |
928 |
||
8314 | 929 |
topViews isNil ifTrue:[ |
930 |
^ nil |
|
6849 | 931 |
]. |
8314 | 932 |
^ topViews |
933 |
detect:[:t | t isModal not] |
|
934 |
ifNone:[topViews first "a modal application"] |
|
935 |
||
936 |
"Modified: / 20-03-2018 / 14:53:23 / stefan" |
|
2445 | 937 |
! |
938 |
||
26 | 939 |
removeView:aView |
940 |
"remove aView from the windowGroup; |
|
941 |
if this was the last view in this group, |
|
81 | 942 |
also shut down the corresponding process |
943 |
(actually, only wake it up here - it will terminate itself |
|
944 |
when finding out that all views are gone)" |
|
11 | 945 |
|
263 | 946 |
|sema| |
947 |
||
3156
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
948 |
focusView == aView ifTrue:[ |
3486
f93691c57540
cleanup - single access to focusView
Claus Gittinger <cg@exept.de>
parents:
3459
diff
changeset
|
949 |
self setFocusView:nil |
3156
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
950 |
]. |
3151 | 951 |
|
11 | 952 |
views notNil ifTrue:[ |
3151 | 953 |
views removeIdentical:aView ifAbsent:nil. |
6097 | 954 |
views := views asNilIfEmpty. |
11 | 955 |
]. |
956 |
topViews notNil ifTrue:[ |
|
3151 | 957 |
topViews removeIdentical:aView ifAbsent:nil. |
6097 | 958 |
topViews := topViews asNilIfEmpty. |
11 | 959 |
]. |
54 | 960 |
" |
961 |
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
|
962 |
removed (modalBoxes terminate their modalLoop if so) |
54 | 963 |
" |
262
546f42586e3c
only signal sema if there is one (when views are removed)
Claus Gittinger <cg@exept.de>
parents:
251
diff
changeset
|
964 |
mySensor notNil ifTrue:[ |
3151 | 965 |
(sema := mySensor eventSemaphore) notNil ifTrue:[ |
966 |
sema signal |
|
967 |
] |
|
262
546f42586e3c
only signal sema if there is one (when views are removed)
Claus Gittinger <cg@exept.de>
parents:
251
diff
changeset
|
968 |
] |
1304 | 969 |
|
970 |
"Modified: 1.2.1997 / 12:13:26 / cg" |
|
11 | 971 |
! |
972 |
||
244 | 973 |
topViews |
2445 | 974 |
"return the topviews associated to this windowGroup" |
172 | 975 |
|
244 | 976 |
^ topViews |
172 | 977 |
! |
978 |
||
244 | 979 |
views |
2445 | 980 |
"return the views associated to this windowGroup" |
172 | 981 |
|
244 | 982 |
^ views |
54 | 983 |
! ! |
984 |
||
3887 | 985 |
!WindowGroup methodsFor:'activation & deactivation'! |
244 | 986 |
|
987 |
closeDownViews |
|
988 |
"destroy all views associated to this window group" |
|
989 |
||
8314 | 990 |
|list| |
991 |
||
244 | 992 |
topViews notNil ifTrue:[ |
8314 | 993 |
list := topViews. |
994 |
topViews := nil. |
|
995 |
list do:[:eachTopView | |
|
996 |
eachTopView notNil ifTrue:[ |
|
997 |
eachTopView destroy |
|
998 |
]. |
|
3130
d489adbd1fd2
enumerate a copy of the collection, when closing down views
Claus Gittinger <cg@exept.de>
parents:
3103
diff
changeset
|
999 |
] |
244 | 1000 |
]. |
1001 |
views := nil. |
|
5285 | 1002 |
|
1003 |
"/ keep the sensor in case there are pending incoming events; |
|
1004 |
"/ otherwise there is a chance that we end up in a debugger in the |
|
1005 |
"/ device's event handling (wGroup nonNil, but sensor isNil) for |
|
1006 |
"/ the unmappedView and focusOUT events. |
|
1007 |
mySensor flushAllEvents. |
|
1008 |
"/ mySensor := nil. |
|
2644
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
1009 |
|
8314 | 1010 |
"Modified: / 06-05-1999 / 09:47:18 / cg" |
1011 |
"Modified: / 20-03-2018 / 14:45:29 / stefan" |
|
244 | 1012 |
! |
1013 |
||
7590 | 1014 |
hideTopViews |
1015 |
"unmap all topViews associated to this windowGroup." |
|
1016 |
||
1017 |
topViews notNil ifTrue:[ |
|
1018 |
topViews do:[:aView | |
|
1019 |
aView hide. |
|
1020 |
]. |
|
1021 |
]. |
|
1022 |
! |
|
1023 |
||
3286
21f022859294
flush device-queue when showing cursor,
Claus Gittinger <cg@exept.de>
parents:
3281
diff
changeset
|
1024 |
modalDialogFinished |
21f022859294
flush device-queue when showing cursor,
Claus Gittinger <cg@exept.de>
parents:
3281
diff
changeset
|
1025 |
"invoked, when a modal dialog is closed" |
21f022859294
flush device-queue when showing cursor,
Claus Gittinger <cg@exept.de>
parents:
3281
diff
changeset
|
1026 |
|
21f022859294
flush device-queue when showing cursor,
Claus Gittinger <cg@exept.de>
parents:
3281
diff
changeset
|
1027 |
inModalLoop := false. |
7676 | 1028 |
modalGroup := nil. |
1029 |
||
1030 |
"Modified: / 13-11-2016 / 22:59:11 / cg" |
|
3286
21f022859294
flush device-queue when showing cursor,
Claus Gittinger <cg@exept.de>
parents:
3281
diff
changeset
|
1031 |
! |
21f022859294
flush device-queue when showing cursor,
Claus Gittinger <cg@exept.de>
parents:
3281
diff
changeset
|
1032 |
|
7676 | 1033 |
modalDialogStarts:aModalGroup |
3286
21f022859294
flush device-queue when showing cursor,
Claus Gittinger <cg@exept.de>
parents:
3281
diff
changeset
|
1034 |
"invoked, when a modal dialog is opened" |
21f022859294
flush device-queue when showing cursor,
Claus Gittinger <cg@exept.de>
parents:
3281
diff
changeset
|
1035 |
|
8447 | 1036 |
modalGroup := aModalGroup. "/ set it first, so that events may find out that they are |
1037 |
"/ processed in a modal context |
|
1038 |
self processEvents. "/ process any buffered message send events |
|
3286
21f022859294
flush device-queue when showing cursor,
Claus Gittinger <cg@exept.de>
parents:
3281
diff
changeset
|
1039 |
inModalLoop := true. |
7676 | 1040 |
|
1041 |
"Created: / 13-11-2016 / 17:18:31 / cg" |
|
1042 |
"Modified: / 13-11-2016 / 22:58:57 / cg" |
|
8447 | 1043 |
"Modified (comment): / 17-08-2018 / 17:46:38 / Stefan Vogel" |
3286
21f022859294
flush device-queue when showing cursor,
Claus Gittinger <cg@exept.de>
parents:
3281
diff
changeset
|
1044 |
! |
21f022859294
flush device-queue when showing cursor,
Claus Gittinger <cg@exept.de>
parents:
3281
diff
changeset
|
1045 |
|
1822
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
1046 |
realizeTopViews |
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
1047 |
"realize all topViews associated to this windowGroup." |
244 | 1048 |
|
1049 |
topViews notNil ifTrue:[ |
|
1977
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
1050 |
topViews do:[:aView | |
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
1051 |
aView realize. |
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
1052 |
]. |
244 | 1053 |
]. |
1822
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
1054 |
|
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
1055 |
"Created: 24.7.1997 / 12:56:09 / cg" |
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
1056 |
! |
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
1057 |
|
2644
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
1058 |
restart |
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
1059 |
"restart after a snapin. |
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
1060 |
This re-creates the windowGroup process and informs |
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
1061 |
my views." |
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
1062 |
|
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
1063 |
topViews notNil ifTrue:[ |
8069 | 1064 |
" |
1065 |
need a new semaphore, since obsolete processes |
|
1066 |
(from our previous live) may still sit on the current semaphore |
|
1067 |
" |
|
1068 |
mySensor eventSemaphore:(Semaphore name:'WGroup eventSema'). |
|
1069 |
isModal ifFalse:[ |
|
1070 |
self startupWith:[self restartTopViews]. |
|
1071 |
] |
|
2644
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
1072 |
] |
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
1073 |
|
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
1074 |
"Modified: / 6.5.1999 / 09:46:08 / cg" |
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
1075 |
! |
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
1076 |
|
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
1077 |
restartTopViews |
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
1078 |
"inform all topViews associated to this windowGroup. |
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
1079 |
about the restart." |
1822
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
1080 |
|
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
1081 |
topViews notNil ifTrue:[ |
2723 | 1082 |
topViews do:[:aView | |
1083 |
aView isPopUpView ifFalse:[ |
|
2644
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
1084 |
"/ aView realize. |
2723 | 1085 |
aView restarted |
1086 |
]. |
|
1087 |
]. |
|
1822
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
1088 |
]. |
180 | 1089 |
|
2644
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
1090 |
"Modified: / 6.5.1999 / 09:42:37 / cg" |
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
1091 |
"Created: / 6.5.1999 / 09:46:33 / cg" |
244 | 1092 |
! |
180 | 1093 |
|
4375
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
1094 |
shutDown |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
1095 |
"shutdown the window group; close all views and |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
1096 |
terminate the process" |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
1097 |
|
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
1098 |
self closeDownViews. |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
1099 |
self shutDownProcess. |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
1100 |
! |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
1101 |
|
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
1102 |
shutDownProcess |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
1103 |
"shutdown the window group process" |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
1104 |
|
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
1105 |
|p| |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
1106 |
|
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
1107 |
myProcess notNil ifTrue:[ |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
1108 |
p := myProcess. |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
1109 |
myProcess := nil. |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
1110 |
p terminate. |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
1111 |
] |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
1112 |
! |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
1113 |
|
1822
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
1114 |
startupModal:checkBlock |
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
1115 |
"startup the window-group in a modal loop |
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
1116 |
(i.e. under the currently running process); |
1876
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
1117 |
checkBlock is evaluated and the modal loop is left, |
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
1118 |
whenever false is returned." |
1822
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
1119 |
|
7827 | 1120 |
^ self startupModal:checkBlock forGroup:(self class activeGroup). |
1121 |
||
1122 |
"Created: / 10-12-1995 / 14:15:11 / cg" |
|
1123 |
"Modified: / 20-08-1997 / 17:54:33 / cg" |
|
1124 |
"Modified: / 31-01-2017 / 20:43:37 / stefan" |
|
1822
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
1125 |
! |
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
1126 |
|
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
1127 |
startupModal:checkBlock forGroup:mainGroup |
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
1128 |
"startup the window-group in a modal loop |
3780
69a0a7142c48
remember process which created a modal group,
Claus Gittinger <cg@exept.de>
parents:
3777
diff
changeset
|
1129 |
(i.e. under the currently running process - NOT creating a new process); |
69a0a7142c48
remember process which created a modal group,
Claus Gittinger <cg@exept.de>
parents:
3777
diff
changeset
|
1130 |
checkBlock is evaluated and loop is left, when false is returned. |
1822
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
1131 |
The mainGroup info is required to allow peeking into its |
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
1132 |
event queue in order for its expose/redraws to be handled." |
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
1133 |
|
4182 | 1134 |
|prevActiveKeyboardGrab prevActivePointerGrab prevFocus device tops prevGroup |
5270
5db2458e62c4
return focus disabled (the getKeyboadFocus as implemented
Claus Gittinger <cg@exept.de>
parents:
5267
diff
changeset
|
1135 |
oldFocusScheme returnFocus| |
5db2458e62c4
return focus disabled (the getKeyboadFocus as implemented
Claus Gittinger <cg@exept.de>
parents:
5267
diff
changeset
|
1136 |
|
5445
eb5e6920f2da
changed: #startupModal:forGroup:
Claus Gittinger <cg@exept.de>
parents:
5364
diff
changeset
|
1137 |
"/ experimental (but seem to work fine...) |
eb5e6920f2da
changed: #startupModal:forGroup:
Claus Gittinger <cg@exept.de>
parents:
5364
diff
changeset
|
1138 |
returnFocus := false. |
eb5e6920f2da
changed: #startupModal:forGroup:
Claus Gittinger <cg@exept.de>
parents:
5364
diff
changeset
|
1139 |
oldFocusScheme := false. |
3348 | 1140 |
|
1822
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
1141 |
"set previousGroup to the main (non-modal) group" |
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
1142 |
|
6118 | 1143 |
previousGroup isNil ifTrue:[ |
7633 | 1144 |
(mainGroup ~~ self) ifTrue:[ |
1145 |
previousGroup := mainGroup |
|
1146 |
]. |
|
6118 | 1147 |
]. |
3348 | 1148 |
prevGroup := previousGroup. |
3354 | 1149 |
prevGroup notNil ifTrue:[ |
1150 |
"/ remember current grab, in case I am opened by |
|
1151 |
"/ a popup (such as an extendedComboBox) ... |
|
1152 |
device := prevGroup graphicsDevice. |
|
1153 |
prevActiveKeyboardGrab := device activeKeyboardGrab. |
|
1154 |
prevActivePointerGrab := device activePointerGrab. |
|
1155 |
]. |
|
1822
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
1156 |
isModal := true. |
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
1157 |
|
3780
69a0a7142c48
remember process which created a modal group,
Claus Gittinger <cg@exept.de>
parents:
3777
diff
changeset
|
1158 |
myProcess isNil ifTrue:[ |
69a0a7142c48
remember process which created a modal group,
Claus Gittinger <cg@exept.de>
parents:
3777
diff
changeset
|
1159 |
creatingProcess := Processor activeProcess |
69a0a7142c48
remember process which created a modal group,
Claus Gittinger <cg@exept.de>
parents:
3777
diff
changeset
|
1160 |
]. |
69a0a7142c48
remember process which created a modal group,
Claus Gittinger <cg@exept.de>
parents:
3777
diff
changeset
|
1161 |
|
5445
eb5e6920f2da
changed: #startupModal:forGroup:
Claus Gittinger <cg@exept.de>
parents:
5364
diff
changeset
|
1162 |
oldFocusScheme ifTrue:[ |
eb5e6920f2da
changed: #startupModal:forGroup:
Claus Gittinger <cg@exept.de>
parents:
5364
diff
changeset
|
1163 |
previousGroup notNil ifTrue:[ |
eb5e6920f2da
changed: #startupModal:forGroup:
Claus Gittinger <cg@exept.de>
parents:
5364
diff
changeset
|
1164 |
prevFocus := previousGroup focusView. |
eb5e6920f2da
changed: #startupModal:forGroup:
Claus Gittinger <cg@exept.de>
parents:
5364
diff
changeset
|
1165 |
]. |
eb5e6920f2da
changed: #startupModal:forGroup:
Claus Gittinger <cg@exept.de>
parents:
5364
diff
changeset
|
1166 |
]. |
eb5e6920f2da
changed: #startupModal:forGroup:
Claus Gittinger <cg@exept.de>
parents:
5364
diff
changeset
|
1167 |
|
3281
95e6d0e98f92
care for modal dialogs in automatic busy cursor handling
Claus Gittinger <cg@exept.de>
parents:
3280
diff
changeset
|
1168 |
mainGroup notNil ifTrue:[ |
95e6d0e98f92
care for modal dialogs in automatic busy cursor handling
Claus Gittinger <cg@exept.de>
parents:
3280
diff
changeset
|
1169 |
"/ tell the other group, that some modal dialog has started. |
7676 | 1170 |
mainGroup modalDialogStarts:self. |
3281
95e6d0e98f92
care for modal dialogs in automatic busy cursor handling
Claus Gittinger <cg@exept.de>
parents:
3280
diff
changeset
|
1171 |
]. |
5445
eb5e6920f2da
changed: #startupModal:forGroup:
Claus Gittinger <cg@exept.de>
parents:
5364
diff
changeset
|
1172 |
[ |
7619 | 1173 |
self realizeTopViews. |
8292 | 1174 |
self eventLoopWhile:checkBlock onLeave:[] |
5445
eb5e6920f2da
changed: #startupModal:forGroup:
Claus Gittinger <cg@exept.de>
parents:
5364
diff
changeset
|
1175 |
] ensure:[ |
eb5e6920f2da
changed: #startupModal:forGroup:
Claus Gittinger <cg@exept.de>
parents:
5364
diff
changeset
|
1176 |
mainGroup notNil ifTrue:[ |
eb5e6920f2da
changed: #startupModal:forGroup:
Claus Gittinger <cg@exept.de>
parents:
5364
diff
changeset
|
1177 |
"/ tell the other group, that some modal dialog has closed down. |
eb5e6920f2da
changed: #startupModal:forGroup:
Claus Gittinger <cg@exept.de>
parents:
5364
diff
changeset
|
1178 |
mainGroup modalDialogFinished |
eb5e6920f2da
changed: #startupModal:forGroup:
Claus Gittinger <cg@exept.de>
parents:
5364
diff
changeset
|
1179 |
] |
3352 | 1180 |
]. |
5445
eb5e6920f2da
changed: #startupModal:forGroup:
Claus Gittinger <cg@exept.de>
parents:
5364
diff
changeset
|
1181 |
|
eb5e6920f2da
changed: #startupModal:forGroup:
Claus Gittinger <cg@exept.de>
parents:
5364
diff
changeset
|
1182 |
returnFocus ifTrue:[ |
eb5e6920f2da
changed: #startupModal:forGroup:
Claus Gittinger <cg@exept.de>
parents:
5364
diff
changeset
|
1183 |
"/ restore current grab, in case was opened by |
eb5e6920f2da
changed: #startupModal:forGroup:
Claus Gittinger <cg@exept.de>
parents:
5364
diff
changeset
|
1184 |
"/ a popup (such as an extendedComboBox) ... |
eb5e6920f2da
changed: #startupModal:forGroup:
Claus Gittinger <cg@exept.de>
parents:
5364
diff
changeset
|
1185 |
mainGroup notNil ifTrue:[ |
eb5e6920f2da
changed: #startupModal:forGroup:
Claus Gittinger <cg@exept.de>
parents:
5364
diff
changeset
|
1186 |
(prevGroup isModal or:[prevGroup isPopUp]) ifTrue:[ |
eb5e6920f2da
changed: #startupModal:forGroup:
Claus Gittinger <cg@exept.de>
parents:
5364
diff
changeset
|
1187 |
" |
eb5e6920f2da
changed: #startupModal:forGroup:
Claus Gittinger <cg@exept.de>
parents:
5364
diff
changeset
|
1188 |
return the input focus to the previously active group's top. |
eb5e6920f2da
changed: #startupModal:forGroup:
Claus Gittinger <cg@exept.de>
parents:
5364
diff
changeset
|
1189 |
" |
eb5e6920f2da
changed: #startupModal:forGroup:
Claus Gittinger <cg@exept.de>
parents:
5364
diff
changeset
|
1190 |
tops := prevGroup topViews. |
eb5e6920f2da
changed: #startupModal:forGroup:
Claus Gittinger <cg@exept.de>
parents:
5364
diff
changeset
|
1191 |
tops notEmptyOrNil ifTrue:[ |
eb5e6920f2da
changed: #startupModal:forGroup:
Claus Gittinger <cg@exept.de>
parents:
5364
diff
changeset
|
1192 |
tops first getKeyboardFocus. |
eb5e6920f2da
changed: #startupModal:forGroup:
Claus Gittinger <cg@exept.de>
parents:
5364
diff
changeset
|
1193 |
]. |
3348 | 1194 |
]. |
1195 |
]. |
|
1196 |
]. |
|
5445
eb5e6920f2da
changed: #startupModal:forGroup:
Claus Gittinger <cg@exept.de>
parents:
5364
diff
changeset
|
1197 |
|
eb5e6920f2da
changed: #startupModal:forGroup:
Claus Gittinger <cg@exept.de>
parents:
5364
diff
changeset
|
1198 |
oldFocusScheme ifFalse:[ |
eb5e6920f2da
changed: #startupModal:forGroup:
Claus Gittinger <cg@exept.de>
parents:
5364
diff
changeset
|
1199 |
previousGroup notNil ifTrue:[ |
eb5e6920f2da
changed: #startupModal:forGroup:
Claus Gittinger <cg@exept.de>
parents:
5364
diff
changeset
|
1200 |
prevFocus := previousGroup focusView. |
eb5e6920f2da
changed: #startupModal:forGroup:
Claus Gittinger <cg@exept.de>
parents:
5364
diff
changeset
|
1201 |
]. |
4182 | 1202 |
]. |
1203 |
||
1204 |
prevFocus notNil ifTrue:[ |
|
1205 |
previousGroup focusView requestFocus |
|
1206 |
]. |
|
1207 |
||
3348 | 1208 |
prevActivePointerGrab notNil ifTrue:[ device grabPointerInView:prevActivePointerGrab ]. |
1209 |
prevActiveKeyboardGrab notNil ifTrue:[ device grabKeyboardInView:prevActiveKeyboardGrab ]. |
|
1210 |
||
7676 | 1211 |
"Created: / 10-12-1995 / 14:14:26 / cg" |
1212 |
"Modified: / 13-11-2016 / 17:19:16 / cg" |
|
1213 |
"Modified (format): / 14-11-2016 / 10:24:03 / cg" |
|
8292 | 1214 |
"Modified: / 15-02-2018 / 18:32:24 / stefan" |
1822
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
1215 |
! |
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
1216 |
|
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
1217 |
startupWith:startupAction |
244 | 1218 |
"startup the window-group; |
1822
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
1219 |
this creates a new window group process, which does the event processing. |
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
1220 |
The startupAction arg is evaluated by the windowGroup process, |
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
1221 |
before the eventLoop is entered, and is used to realize any views. |
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
1222 |
[this is done to have the new process realize its views, instead of |
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
1223 |
the caller - which may make a difference in case of errors and/or |
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
1224 |
blocking operations ...]" |
244 | 1225 |
|
7984 | 1226 |
|invokingApp| |
244 | 1227 |
|
1228 |
previousGroup := nil. |
|
1186
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
1229 |
|
244 | 1230 |
myProcess isNil ifTrue:[ |
3172
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1231 |
isModal := false. |
1186
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
1232 |
|
3172
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1233 |
"/ |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1234 |
"/ this is the windowGroup process; |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1235 |
"/ realize all views, then handle events forever |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1236 |
"/ (well, not really forever ... ;-) |
2878 | 1237 |
|
3172
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1238 |
myProcess := [ |
7827 | 1239 |
[ |
1240 |
startupAction value. |
|
1241 |
self showWaitCursorWhenBusyForMillis:400. |
|
8292 | 1242 |
self eventLoopWhile:[true] onLeave:[]. |
7827 | 1243 |
] ensure:[ |
1244 |
|dev w app| |
|
1245 |
||
1246 |
(w := self mainView) notNil ifTrue:[ |
|
1247 |
(app := w application) notNil ifTrue:[ |
|
1248 |
app release |
|
1249 |
] |
|
1250 |
]. |
|
1251 |
dev := self graphicsDevice. |
|
1252 |
(dev notNil and:[views notNil]) ifTrue:[ |
|
1253 |
dev deviceIOErrorSignal catch:[ |
|
1254 |
"/ just in case the view did not yet have a chance to |
|
1255 |
"/ shutDown properly (process killed in processMonitor) |
|
7619 | 1256 |
self closeDownViews |
3172
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1257 |
] |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1258 |
] |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1259 |
] |
7827 | 1260 |
] newProcess. |
1186
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
1261 |
|
4375
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
1262 |
self setProcessNameWithRedirectIndicator:''. |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
1263 |
myProcess priority:processPriority; |
3341 | 1264 |
beGroupLeader; |
1265 |
beGUIProcess. |
|
180 | 1266 |
|
3172
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1267 |
"/ |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1268 |
"/ when the process gets suspended, |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1269 |
"/ there maybe still buffered draw requests. |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1270 |
"/ Arrange for them to be flushed then. |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1271 |
"/ (otherwise, you would not see the output of a process, |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1272 |
"/ which suspends and waits - or we had to add buffer flushes |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1273 |
"/ all over the place) |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1274 |
"/ |
4801 | 1275 |
myProcess |
1276 |
addSuspendAction:[ |
|
1277 |
|dev| |
|
1278 |
||
1279 |
dev := self graphicsDevice. |
|
1280 |
dev notNil ifTrue:[dev flush]. |
|
1281 |
]. |
|
2851 | 1282 |
|
3172
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1283 |
"/ allow for the currently active application, |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1284 |
"/ to hook on new-application process creation. |
7984 | 1285 |
invokingApp := self class activeMainApplication. |
1286 |
invokingApp notNil ifTrue:[ |
|
3172
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1287 |
invokingApp postApplicationProcessCreate:myProcess windowGroup:self. |
7984 | 1288 |
invokingApp:= nil. "/ to avoid dangling references via blocks home context. |
3172
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1289 |
]. |
2959 | 1290 |
|
3172
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1291 |
myProcess resume. |
244 | 1292 |
] |
313 | 1293 |
|
4801 | 1294 |
"Created: / 24-07-1997 / 12:52:04 / cg" |
1295 |
"Modified: / 17-09-2007 / 10:59:34 / cg" |
|
8292 | 1296 |
"Modified: / 15-02-2018 / 18:29:11 / stefan" |
7590 | 1297 |
! |
1298 |
||
1299 |
unhideTopViews |
|
1300 |
"map all topViews associated to this windowGroup." |
|
1301 |
||
1302 |
|first| |
|
1303 |
||
1304 |
topViews notNil ifTrue:[ |
|
1305 |
first := true. |
|
1306 |
topViews do:[:aView | |
|
1307 |
aView map. |
|
1308 |
first ifTrue:[ |
|
1309 |
aView activate. |
|
1310 |
first := false. |
|
1311 |
]. |
|
1312 |
]. |
|
1313 |
]. |
|
3373
3585120d4d58
only eat a modal Escape-key event, if the modalView did unmap
Claus Gittinger <cg@exept.de>
parents:
3372
diff
changeset
|
1314 |
! ! |
180 | 1315 |
|
90 | 1316 |
!WindowGroup methodsFor:'enumerating'! |
54 | 1317 |
|
1117 | 1318 |
allNonTopViewsDo:aBlock |
1319 |
"evaluate aBlock for all nonTopviews (i.e. subviews) in this group. |
|
1334 | 1320 |
This enumerates a copy of the view collection, to allow for |
1240 | 1321 |
destroy and other collection changing operations to be performed in the loop." |
1117 | 1322 |
|
1323 |
views notNil ifTrue:[ |
|
1977
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
1324 |
views copy nonNilElementsDo:aBlock |
1117 | 1325 |
] |
1334 | 1326 |
|
1327 |
"Modified: 12.2.1997 / 12:20:25 / cg" |
|
1117 | 1328 |
! |
1329 |
||
1153 | 1330 |
allTopViewsDo:aBlock |
1331 |
"evaluate aBlock for all topviews in this group. |
|
1334 | 1332 |
This enumerates a copy of the view collection, to allow for |
1240 | 1333 |
destroy and other collection changing operations to be performed in the loop." |
1153 | 1334 |
|
1335 |
topViews notNil ifTrue:[ |
|
1977
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
1336 |
topViews copy nonNilElementsDo:aBlock |
1153 | 1337 |
] |
1334 | 1338 |
|
1339 |
"Modified: 12.2.1997 / 12:20:30 / cg" |
|
1153 | 1340 |
! |
1341 |
||
54 | 1342 |
allTopViewsExcept:aView do:aBlock |
157 | 1343 |
"evaluate aBlock for all topviews except aView in this group. |
1334 | 1344 |
This enumerates a copy of the view collection, to allow for |
1240 | 1345 |
destroy and other collection changing operations to be performed in the loop." |
157 | 1346 |
|
1334 | 1347 |
self allTopViewsDo:[:v | |
1977
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
1348 |
v ~~ aView ifTrue:[aBlock value:v] |
157 | 1349 |
]. |
1334 | 1350 |
|
1351 |
"Modified: 12.2.1997 / 12:22:10 / cg" |
|
157 | 1352 |
! |
1353 |
||
244 | 1354 |
allViewsDo:aBlock |
1355 |
"evaluate aBlock for all views & topviews in this group. |
|
1334 | 1356 |
This enumerates a copy of the view collection, to allow for |
1240 | 1357 |
destroy and other collection changing operations to be performed in the loop." |
244 | 1358 |
|
1117 | 1359 |
self allTopViewsDo:aBlock. |
1360 |
self allNonTopViewsDo:aBlock. |
|
1334 | 1361 |
|
1362 |
"Modified: 12.2.1997 / 12:20:20 / cg" |
|
244 | 1363 |
! |
1364 |
||
1365 |
partnersDo:aBlock |
|
1366 |
"evaluate aBlock for all partnerViews. |
|
1334 | 1367 |
This enumerates a copy of the view collection, to allow for |
1240 | 1368 |
destroy and other collection changing operations to be performed in the loop." |
244 | 1369 |
|
1334 | 1370 |
self allTopViewsDo:[:v | |
3622
42b9c35a0f18
use #isSlave, #isPartner instead of comparing the type
Claus Gittinger <cg@exept.de>
parents:
3619
diff
changeset
|
1371 |
v isPartner ifTrue:[aBlock value:v]. |
244 | 1372 |
]. |
1334 | 1373 |
|
1374 |
"Modified: 12.2.1997 / 12:21:41 / cg" |
|
244 | 1375 |
! |
1376 |
||
157 | 1377 |
slavesDo:aBlock |
1378 |
"evaluate aBlock for all slaveViews. |
|
1334 | 1379 |
This enumerates a copy of the view collection, to allow for |
1240 | 1380 |
destroy and other collection changing operations to be performed in the loop." |
54 | 1381 |
|
1334 | 1382 |
self allTopViewsDo:[:v | |
3622
42b9c35a0f18
use #isSlave, #isPartner instead of comparing the type
Claus Gittinger <cg@exept.de>
parents:
3619
diff
changeset
|
1383 |
v isSlave ifTrue:[aBlock value:v]. |
157 | 1384 |
]. |
1334 | 1385 |
|
1386 |
"Modified: 12.2.1997 / 12:21:46 / cg" |
|
11 | 1387 |
! ! |
1388 |
||
605
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
1389 |
!WindowGroup methodsFor:'event debugging'! |
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
1390 |
|
3786
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
1391 |
traceEvents |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
1392 |
"return the event tracing flag" |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
1393 |
|
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
1394 |
^ traceEvents |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
1395 |
! |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
1396 |
|
605
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
1397 |
traceEvents:trueOrFalse |
3786
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
1398 |
"turn event tracing on/off" |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
1399 |
|
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
1400 |
traceEvents := trueOrFalse |
605
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
1401 |
! ! |
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
1402 |
|
19 | 1403 |
!WindowGroup methodsFor:'event handling'! |
11 | 1404 |
|
244 | 1405 |
eventLoop |
1406 |
"loop executed by windowGroup process; |
|
1407 |
wait-for and process events forever" |
|
1408 |
||
8292 | 1409 |
self eventLoopWhile:[true] onLeave:[] |
1410 |
||
1411 |
"Modified: / 15-02-2018 / 18:31:58 / stefan" |
|
244 | 1412 |
! |
1413 |
||
1414 |
eventLoopWhile:aBlock onLeave:cleanupActions |
|
8419 | 1415 |
"this is the main event loop in which application sits: |
1416 |
wait-for and process events. |
|
244 | 1417 |
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
|
1418 |
and aBlock evaluates to true. |
244 | 1419 |
|
1752 | 1420 |
Some signals are caught & handled: |
3348 | 1421 |
LeaveSignal forces an exit from the eventLoop; |
4220 | 1422 |
AbortOperationRequest brings us back into the loop, processing the next event; |
3348 | 1423 |
ActivityNotifications send a #showActivity: if nonModal, |
1424 |
otherwise they are ignored." |
|
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
1425 |
|
7827 | 1426 |
|signalsToHandle| |
244 | 1427 |
|
5520 | 1428 |
signalsToHandle := SignalSet |
8292 | 1429 |
with:LeaveSignal |
8419 | 1430 |
with:ActivityNotification |
8421 | 1431 |
with:HaltInterrupt. |
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
1432 |
|
4474
58a2e62065a6
pass up AbortAllSignals to the original handler
Claus Gittinger <cg@exept.de>
parents:
4413
diff
changeset
|
1433 |
(isModal not or:[AbortAllOperationRequest isHandled not]) ifTrue:[ |
5520 | 1434 |
signalsToHandle add:AbortAllOperationRequest |
4474
58a2e62065a6
pass up AbortAllSignals to the original handler
Claus Gittinger <cg@exept.de>
parents:
4413
diff
changeset
|
1435 |
]. |
5520 | 1436 |
doNotCloseOnAbortSignal ifTrue:[ |
1437 |
signalsToHandle add:AbortOperationRequest |
|
5288 | 1438 |
]. |
1439 |
||
8330 | 1440 |
WindowGroupQuery answer:self do:[ |
1441 |
[ "/ ... ensure |
|
8292 | 1442 |
|g mainGroup mySema waitSema mainSema groupForSema| |
7619 | 1443 |
|
1444 |
waitSema := mySema := mySensor eventSemaphore. |
|
1445 |
||
1446 |
isModal ifTrue:[ |
|
1447 |
mainGroup := self mainGroup. |
|
1448 |
mainGroup == self ifTrue:[ |
|
1449 |
mainGroup := nil |
|
1450 |
]. |
|
1451 |
] ifFalse:[ |
|
1452 |
mainGroup := previousGroup |
|
3348 | 1453 |
]. |
7619 | 1454 |
|
1455 |
"/ if this is an event loop for a modal loop (popup or dialog), |
|
1456 |
"/ also make sure that we react on events coming for the mainGroup |
|
1457 |
"/ to allow for redraw of those views. |
|
1458 |
mainGroup notNil ifTrue:[ |
|
1459 |
mainSema := mainGroup sensor eventSemaphore. |
|
1460 |
waitSema := SemaphoreSet with:mySema with:mainSema. |
|
1461 |
||
1462 |
"/ must also care for all other groups in between |
|
1463 |
"/ (in case its a modal dialog opened from a modal dialog) |
|
1464 |
g := previousGroup. |
|
1465 |
g ~~ mainGroup ifTrue:[ |
|
1466 |
groupForSema := IdentityDictionary new. |
|
8292 | 1467 |
[ |
1468 |
|eventSema| |
|
1469 |
||
7619 | 1470 |
g sensor notNil ifTrue:[ |
8292 | 1471 |
eventSema := g sensor eventSemaphore. |
1472 |
waitSema add:eventSema. |
|
1473 |
groupForSema at:eventSema put:g. |
|
7619 | 1474 |
]. |
1475 |
g := g previousGroup. |
|
8292 | 1476 |
g ~~ mainGroup |
1477 |
] whileTrue. |
|
3348 | 1478 |
]. |
1479 |
]. |
|
1480 |
||
7841 | 1481 |
aBlock whileTrue:[ |
7619 | 1482 |
(views isNil and:[topViews isNil]) ifTrue:[ |
1483 |
myProcess notNil ifTrue:[ |
|
1484 |
self shutDownProcess. |
|
1485 |
"not reached - there is no life after death" |
|
1486 |
]. |
|
1487 |
" |
|
1488 |
this is the end of a modal loop |
|
1489 |
(not having a private process ...) |
|
1490 |
" |
|
3348 | 1491 |
^ self |
1492 |
]. |
|
1493 |
||
7619 | 1494 |
(graphicsDevice notNil and:[graphicsDevice isOpen not]) ifTrue:[ |
1495 |
self closeDownViews. |
|
1496 |
^ self. |
|
3348 | 1497 |
]. |
7619 | 1498 |
|
1499 |
signalsToHandle handle:[:ex | |
|
1500 |
|theSig| |
|
1501 |
||
1502 |
theSig := ex creator. |
|
1503 |
(AbortAllOperationRequest accepts:theSig) ifTrue:[ |
|
1504 |
"on AbortAllOperationRequest or AbortOperationRequest, |
|
1505 |
stay in loop" |
|
1506 |
ex return |
|
3348 | 1507 |
]. |
7619 | 1508 |
theSig == LeaveSignal ifTrue:[ |
1509 |
"/ |
|
1510 |
"/ on leave, exit the event loop |
|
1511 |
"/ |
|
1512 |
self closeDownViews. |
|
1513 |
^ self |
|
1514 |
]. |
|
8421 | 1515 |
(HaltInterrupt accepts:theSig) ifTrue:[ |
1516 |
haltInterruptHandler isNil ifTrue:[ |
|
8419 | 1517 |
ex reject. |
1518 |
]. |
|
8421 | 1519 |
haltInterruptHandler valueWithOptionalArgument:ex. |
8419 | 1520 |
ex resume. |
1521 |
]. |
|
1522 |
||
7619 | 1523 |
"/ ActivityNotification |
1524 |
"/ |
|
1525 |
"/ if I am a modal-group, let it be handled |
|
8419 | 1526 |
"/ by the outer main-group's handler (but only if there is one) |
7619 | 1527 |
"/ otherwise show the activityMessage and continue. |
1528 |
"/ |
|
1529 |
isModal ifTrue:[ |
|
1530 |
(theSig isHandledIn:ex handlerContext sender) ifTrue:[ |
|
4408
308c798612a8
more care for brokenConnections.
Claus Gittinger <cg@exept.de>
parents:
4378
diff
changeset
|
1531 |
ex reject. |
7619 | 1532 |
"never reached" |
4408
308c798612a8
more care for brokenConnections.
Claus Gittinger <cg@exept.de>
parents:
4378
diff
changeset
|
1533 |
]. |
5569
25b945e9c1f5
changed: #eventLoopWhile:onLeave:
Claus Gittinger <cg@exept.de>
parents:
5520
diff
changeset
|
1534 |
] ifFalse:[ |
7619 | 1535 |
self showActivity:ex messageText. |
5569
25b945e9c1f5
changed: #eventLoopWhile:onLeave:
Claus Gittinger <cg@exept.de>
parents:
5520
diff
changeset
|
1536 |
]. |
7619 | 1537 |
ex proceedWith:nil. |
1538 |
] do:[ |
|
7827 | 1539 |
|gotSema mainView| |
7619 | 1540 |
|
1541 |
(mainGroup notNil or:[mySensor hasEvents not]) ifTrue:[ |
|
1542 |
waitSema isNil ifTrue:[ |
|
1543 |
"/ oops - how can this happen .... |
|
1544 |
^ self. |
|
1545 |
]. |
|
1546 |
"/ Flush device output before going to sleep. |
|
1547 |
"/ This may produce more events to arrive. |
|
1548 |
"/ Q: is this still needed (see suspendAction) ? |
|
1549 |
Error |
|
1550 |
handle:[:ex | |
|
1551 |
(graphicsDevice notNil and:[graphicsDevice isOpen not]) ifTrue:[ |
|
1552 |
'WindowGroup [warning]: Error in flush - closing views' errorPrintCR. |
|
1553 |
self closeDownViews. |
|
1554 |
^ self. |
|
1555 |
]. |
|
1556 |
ex reject. |
|
1557 |
] |
|
1558 |
do:[ |
|
1559 |
self graphicsDevice flush. |
|
1560 |
]. |
|
1561 |
||
7827 | 1562 |
Processor activeProcess setStateTo:(self isModal ifTrue:[#modalEventWait] ifFalse:[#eventWait]) if:#active. |
7619 | 1563 |
|
1564 |
"/ now, wait for an event to arrive |
|
1565 |
gotSema := waitSema wait. |
|
3348 | 1566 |
] ifFalse:[ |
7619 | 1567 |
gotSema := mySema |
1568 |
]. |
|
1569 |
||
1570 |
"/ some bad guy ;-) could have closed all down |
|
1571 |
"/ in the meanwhile ... |
|
1572 |
mySensor notNil ifTrue:[ |
|
1573 |
gotSema == mySema ifTrue:[ |
|
1574 |
"/ |
|
1575 |
"/ an event for me |
|
1576 |
"/ |
|
1577 |
self processEventsWithModalGroup:nil |
|
3348 | 1578 |
] ifFalse:[ |
7619 | 1579 |
"/ |
1580 |
"/ modal and an event for my mainGroup or one of the groups in-between |
|
1581 |
"/ (we arrive here after we woke up on maingroup sensor eventSemaphore) |
|
1582 |
"/ |
|
1583 |
groupForSema notNil ifTrue:[ |
|
8292 | 1584 |
g := groupForSema at:gotSema ifAbsent:mainGroup. |
7619 | 1585 |
] ifFalse:[ |
1586 |
g := mainGroup |
|
1587 |
]. |
|
1588 |
||
1589 |
g topViews notNil ifTrue:[ |
|
1590 |
mainView := g topViews first |
|
1591 |
]. |
|
1592 |
mainView notNil ifTrue:[ |
|
1593 |
"/ if anything happened to the mainGroup |
|
1594 |
"/ bring my own topView back to the front |
|
1595 |
"/ This keeps modalBoxes visible |
|
1596 |
"/ (not needed with X, where the windowManager does it for us) |
|
1597 |
(g sensor hasConfigureEventFor:mainView) ifTrue:[ |
|
1598 |
(topViews size ~~ 0 and:[topViews first shown]) ifTrue:[ |
|
1599 |
topViews first raiseDeiconified |
|
1600 |
]. |
|
7131 | 1601 |
]. |
1602 |
]. |
|
7619 | 1603 |
g processEventsWithModalGroup:self. |
1604 |
] |
|
3348 | 1605 |
] |
7619 | 1606 |
]. |
3348 | 1607 |
]. |
7619 | 1608 |
] ensure:cleanupActions |
1609 |
] |
|
313 | 1610 |
|
5569
25b945e9c1f5
changed: #eventLoopWhile:onLeave:
Claus Gittinger <cg@exept.de>
parents:
5520
diff
changeset
|
1611 |
"Modified: / 06-07-2010 / 11:47:27 / cg" |
8330 | 1612 |
"Modified (comment): / 11-04-2018 / 11:30:52 / stefan" |
8421 | 1613 |
"Modified: / 28-06-2018 / 15:16:42 / Claus Gittinger" |
3373
3585120d4d58
only eat a modal Escape-key event, if the modalView did unmap
Claus Gittinger <cg@exept.de>
parents:
3372
diff
changeset
|
1614 |
! |
244 | 1615 |
|
3511
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
1616 |
executePostEventHooksFor:anEvent |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
1617 |
postEventHook notNil ifTrue:[ |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
1618 |
postEventHook processEvent:anEvent |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
1619 |
]. |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
1620 |
postEventHooks notNil ifTrue:[ |
8433 | 1621 |
postEventHooks copy do:[:eachHook | |
3786
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
1622 |
eachHook isBlock ifTrue:[ |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
1623 |
eachHook value:anEvent |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
1624 |
] ifFalse:[ |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
1625 |
eachHook processEvent:anEvent |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
1626 |
] |
3511
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
1627 |
] |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
1628 |
]. |
8433 | 1629 |
|
1630 |
"Modified: / 26-07-2018 / 22:35:02 / Claus Gittinger" |
|
3511
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
1631 |
! |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
1632 |
|
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
1633 |
executePreEventHooksFor:anEvent |
5003 | 1634 |
"return true, if the event was eaten" |
1635 |
||
3786
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
1636 |
traceEvents == true ifTrue:[ |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
1637 |
anEvent displayString infoPrintCR. |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
1638 |
]. |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
1639 |
|
3511
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
1640 |
preEventHook notNil ifTrue:[ |
8502 | 1641 |
(preEventHook processEvent:anEvent) ifTrue:[ |
1642 |
"/ Transcript showCR:('event was eaten by %1' bindWith:preEventHook). |
|
1643 |
^ true |
|
1644 |
]. |
|
3511
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
1645 |
]. |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
1646 |
preEventHooks notNil ifTrue:[ |
8433 | 1647 |
preEventHooks copy do:[:eachHook | |
5584
57e0a4a74d0e
changed: #executePreEventHooksFor:
Claus Gittinger <cg@exept.de>
parents:
5569
diff
changeset
|
1648 |
"/ can only be nil if changed, while enumerating... |
57e0a4a74d0e
changed: #executePreEventHooksFor:
Claus Gittinger <cg@exept.de>
parents:
5569
diff
changeset
|
1649 |
eachHook notNil ifTrue:[ |
57e0a4a74d0e
changed: #executePreEventHooksFor:
Claus Gittinger <cg@exept.de>
parents:
5569
diff
changeset
|
1650 |
eachHook isBlock ifTrue:[ |
8502 | 1651 |
(eachHook value:anEvent) ifTrue:[ |
1652 |
"/ Transcript showCR:('event was eaten by %1' bindWith:eachHook). |
|
1653 |
^ true |
|
1654 |
]. |
|
5584
57e0a4a74d0e
changed: #executePreEventHooksFor:
Claus Gittinger <cg@exept.de>
parents:
5569
diff
changeset
|
1655 |
] ifFalse:[ |
8502 | 1656 |
(eachHook processEvent:anEvent) ifTrue:[ |
1657 |
"/ Transcript showCR:('event was eaten by %1' bindWith:eachHook). |
|
1658 |
^ true |
|
1659 |
]. |
|
5584
57e0a4a74d0e
changed: #executePreEventHooksFor:
Claus Gittinger <cg@exept.de>
parents:
5569
diff
changeset
|
1660 |
] |
3786
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
1661 |
] |
3511
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
1662 |
] |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
1663 |
]. |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
1664 |
^ false |
5584
57e0a4a74d0e
changed: #executePreEventHooksFor:
Claus Gittinger <cg@exept.de>
parents:
5569
diff
changeset
|
1665 |
|
57e0a4a74d0e
changed: #executePreEventHooksFor:
Claus Gittinger <cg@exept.de>
parents:
5569
diff
changeset
|
1666 |
"Modified: / 28-07-2010 / 03:34:33 / cg" |
8433 | 1667 |
"Modified: / 26-07-2018 / 22:34:28 / Claus Gittinger" |
3511
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
1668 |
! |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
1669 |
|
3736 | 1670 |
lastEvent |
8330 | 1671 |
^ LastEventQuery query |
1672 |
||
1673 |
"Modified: / 11-04-2018 / 11:21:21 / stefan" |
|
3736 | 1674 |
! |
1675 |
||
244 | 1676 |
leaveEventLoop |
1677 |
"immediately leave the event loop, returning way back. |
|
1678 |
This can be used to leave (and closedown) a modal group. |
|
1679 |
(for normal views, this does not make sense)" |
|
1680 |
||
1681 |
^ LeaveSignal raise |
|
1682 |
! |
|
1683 |
||
3737 | 1684 |
leaveModalLoop |
1685 |
"if the receiver has a modal window open (i.e. is in a modalLoop), |
|
1686 |
force him to leave it and proceed as usual. |
|
1687 |
Be warned: this is not a regular (i.e. OK/ESCAPE) the modal box closing." |
|
1688 |
||
1689 |
self isInModalLoop ifTrue:[ |
|
8330 | 1690 |
self process interruptWith:[LeaveSignal isHandled ifTrue:[LeaveSignal raise]] |
3737 | 1691 |
]. |
8330 | 1692 |
|
1693 |
"Modified: / 11-04-2018 / 11:35:30 / stefan" |
|
3737 | 1694 |
! |
1695 |
||
103 | 1696 |
processEvents |
6861 | 1697 |
"process all pending events from either the damage- or user input queues. |
103 | 1698 |
Abort is assumed to be handled elsewhere." |
19 | 1699 |
|
1419
a40a4f3ad589
while blocked by a modal view, forward key events to
Claus Gittinger <cg@exept.de>
parents:
1411
diff
changeset
|
1700 |
self processEventsWithModalGroup:nil |
a40a4f3ad589
while blocked by a modal view, forward key events to
Claus Gittinger <cg@exept.de>
parents:
1411
diff
changeset
|
1701 |
|
a40a4f3ad589
while blocked by a modal view, forward key events to
Claus Gittinger <cg@exept.de>
parents:
1411
diff
changeset
|
1702 |
"Modified: 5.3.1997 / 11:33:51 / cg" |
1328 | 1703 |
! |
1704 |
||
1419
a40a4f3ad589
while blocked by a modal view, forward key events to
Claus Gittinger <cg@exept.de>
parents:
1411
diff
changeset
|
1705 |
processEventsWithModalGroup:modalGroup |
6861 | 1706 |
"process all pending events from either the damage- or user input queues. |
5364
6f4ceb2bc439
behavior of escape key, while a chain of popup-menus is open
Claus Gittinger <cg@exept.de>
parents:
5350
diff
changeset
|
1707 |
Abort is assumed to be handled elsewhere. |
6f4ceb2bc439
behavior of escape key, while a chain of popup-menus is open
Claus Gittinger <cg@exept.de>
parents:
5350
diff
changeset
|
1708 |
If modalGroup is non-nil, this is actually called from a modal-groups eventloop, |
6f4ceb2bc439
behavior of escape key, while a chain of popup-menus is open
Claus Gittinger <cg@exept.de>
parents:
5350
diff
changeset
|
1709 |
in order for the underlying mainGroup (me) to handle its redraw events. |
6f4ceb2bc439
behavior of escape key, while a chain of popup-menus is open
Claus Gittinger <cg@exept.de>
parents:
5350
diff
changeset
|
1710 |
In this case, ignore any user input events." |
1328 | 1711 |
|
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
1712 |
<resource: #keyboard (#Escape )> |
496 | 1713 |
|
8330 | 1714 |
|event busyHookBlock busyHookCalled| |
11 | 1715 |
|
72 | 1716 |
self processExposeEvents. |
180 | 1717 |
|
8309 | 1718 |
[ "... on:ensure:" |
7825 | 1719 |
[mySensor notNil |
1720 |
and:[(event := mySensor nextEvent) notNil]] whileTrue:[ |
|
8309 | 1721 |
|ignore focus firstTop evView |
8330 | 1722 |
modalTop modalDelegate modalGroupTopViews keyboardProcessor |
8309 | 1723 |
top evReceiver| |
1724 |
||
7825 | 1725 |
ignore := false. |
1726 |
focus := focusView. |
|
1727 |
modalDelegate := false. |
|
1728 |
modalTop := nil. |
|
1729 |
||
1730 |
modalGroup notNil ifTrue:[ |
|
1731 |
"/ an incoming event for a masterView, |
|
1732 |
"/ while being blocked by some other modalView. |
|
1733 |
||
8310 | 1734 |
modalGroupTopViews := modalGroup topViews. |
1735 |
modalGroupTopViews notNil ifTrue:[ |
|
1736 |
modalTop := modalGroupTopViews firstOrNil. |
|
1737 |
]. |
|
7825 | 1738 |
|
1739 |
event isKeyEvent ifTrue:[ |
|
1740 |
"/ forward keyboard events to my modal |
|
1741 |
"/ groups first topView ... |
|
1742 |
modalTop notNil ifTrue:[ |
|
1743 |
focus := modalTop. |
|
1744 |
modalDelegate := true. |
|
1745 |
]. |
|
1746 |
modalGroup focusView notNil ifTrue:[ |
|
1747 |
focus := modalGroup focusView |
|
3096 | 1748 |
]. |
7825 | 1749 |
] ifFalse:[ |
1750 |
event isFocusEvent ifTrue:[ |
|
1751 |
event isFocusInEvent ifTrue:[ |
|
1752 |
"/ move focus over to modalBox |
|
1753 |
modalTop notNil ifTrue:[ |
|
1754 |
modalTop getKeyboardFocus. |
|
1755 |
"/ focusIn is forwarded to the modalGroup |
|
1756 |
"/ (since keyboard is forwarded) |
|
1757 |
event view:modalTop. |
|
1758 |
focus := modalTop. |
|
1759 |
] |
|
1760 |
] ifFalse:[ |
|
1761 |
"/ focusOut goes to both the modal and |
|
1762 |
"/ the blocked main-group |
|
1763 |
"/ (actually, only the very first focusOut |
|
1764 |
"/ is needed in the mainGroup (to turn off the cursor) |
|
1765 |
"/ all others are only needed in the modalGroup) |
|
1766 |
||
1767 |
"/ syntheticEvent := event copy. |
|
1768 |
"/ syntheticEvent view:modalTop. |
|
1769 |
"/ LastEventQuerySignal handle:[:ex | |
|
1770 |
"/ ex proceedWith:syntheticEvent |
|
1771 |
"/ ] do:[ |
|
1772 |
"/ syntheticEvent sendEventWithFocusOn:nil. |
|
1773 |
"/ ]. |
|
1774 |
||
1775 |
"/ event view:modalTop. |
|
3279
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1776 |
]. |
7825 | 1777 |
modalDelegate := true. |
3279
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1778 |
] ifFalse:[ |
7825 | 1779 |
event isPointerLeaveEvent ifTrue:[ |
3096 | 1780 |
] ifFalse:[ |
7825 | 1781 |
event isUserEvent ifTrue:[ |
1782 |
ignore := true. |
|
1783 |
||
1784 |
event isButtonPressEvent ifTrue:[ |
|
1785 |
"/ raise the modalTop and beep |
|
1786 |
event view device beep. |
|
1787 |
modalTop notNil ifTrue:[ modalTop raise ]. |
|
3279
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1788 |
] |
3096 | 1789 |
] |
1790 |
] |
|
7825 | 1791 |
] |
3279
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1792 |
]. |
7825 | 1793 |
"/ also update the slave-sensor's modifier state from the master-sensor's |
1794 |
"/ state. This is needed for a popUpView to see the correct shift-, ctrl- and alt states |
|
1795 |
"/ in its own sensor. |
|
1796 |
||
1797 |
"/ cg: disabled 15-jun-2014 |
|
1798 |
"/ mhmh - something seems to have changed on a lower level, |
|
1799 |
"/ so now the modal sensor already has the correct sensor state |
|
1800 |
"/ (as opposed to previous versions, where this was not true). |
|
1801 |
"/ Now, enabling the following line leads to a confirmation dialog to NOT |
|
1802 |
"/ behave correctly w.r.t. Shift-CursorRight. |
|
1803 |
"/ I wonder, what is responsible for that fixing side effect... (sigh) |
|
1804 |
"/ modalGroup sensor updateModifierStatesFrom:mySensor |
|
1805 |
]. |
|
1806 |
||
1807 |
ignore ifFalse:[ |
|
1808 |
(views notNil or:[topViews notNil]) ifTrue:[ |
|
1809 |
"/ give eventRecorders, catchers etc. |
|
1810 |
"/ a chance to eat or modify that event |
|
1811 |
modalGroup notNil ifTrue:[ |
|
1812 |
ignore := modalGroup executePreEventHooksFor:event. |
|
1813 |
] ifFalse:[ |
|
1814 |
ignore := false |
|
1815 |
]. |
|
1816 |
ignore ifFalse:[ |
|
1817 |
ignore := self executePreEventHooksFor:event. |
|
3777 | 1818 |
ignore ifFalse:[ |
7825 | 1819 |
evView := event view. |
1820 |
||
1821 |
(event isKeyEvent |
|
1822 |
and:[(keyboardProcessor := (modalTop ? evView topView) keyboardProcessor) notNil]) ifTrue:[ |
|
1823 |
ignore := keyboardProcessor processEvent:event forModalView:modalTop |
|
1824 |
]. |
|
1825 |
||
4475 | 1826 |
ignore ifFalse:[ |
7825 | 1827 |
"/ event handling below will vanish ... |
1828 |
"/ (keyboardProcessor will do it eventually) |
|
1829 |
||
1830 |
event isKeyPressEvent ifTrue:[ |
|
1831 |
event key == #Escape ifTrue:[ |
|
1832 |
modalDelegate ifTrue:[ |
|
1833 |
top := modalTop. |
|
1834 |
] ifFalse:[ |
|
1835 |
(isModal and:[topViews notEmptyOrNil]) ifTrue:[ |
|
1836 |
top := topViews first. |
|
1837 |
] |
|
1838 |
]. |
|
1839 |
top notNil ifTrue:[ |
|
1840 |
"/ a popUpView does it himself (only closing one submenu) |
|
1841 |
(top isPopUpView not |
|
1842 |
or:[UserPreferences current closePopUpMenuChainOnEscape]) ifTrue:[ |
|
1843 |
top escapeIsCancel ifTrue:[ |
|
1844 |
top closeCancel. |
|
1845 |
"/ top hideRequest. |
|
1846 |
top realized ifFalse:[ ignore := true ]. |
|
4475 | 1847 |
] |
1848 |
] |
|
7825 | 1849 |
]. |
1850 |
] |
|
1851 |
] ifFalse:[ |
|
1852 |
"/ |
|
1853 |
"/ keep track of which view has the pointer |
|
1854 |
"/ |
|
1855 |
event isPointerEnterEvent ifTrue:[ |
|
1856 |
pointerView := evView |
|
1857 |
] ifFalse:[event isPointerLeaveEvent ifTrue:[ |
|
1858 |
pointerView := nil |
|
1859 |
]]. |
|
4475 | 1860 |
]. |
3279
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1861 |
]. |
3349 | 1862 |
]. |
7825 | 1863 |
]. |
1864 |
||
1865 |
ignore ifFalse:[ |
|
1866 |
"/ |
|
1867 |
"/ buttonPress events turn off explicit focus, and reverts |
|
1868 |
"/ to implicit focus control |
|
1869 |
"/ This used to be done for every click - |
|
1870 |
"/ but behaved ugly if clicking in a scrollbar ... |
|
1871 |
||
1872 |
"/ XXX: move to dispatchEvent |
|
1873 |
event isButtonPressEvent ifTrue:[ |
|
1874 |
(evView wantsFocusWithButtonPress) ifTrue:[ |
|
1875 |
"/ cannot use 'evView requestFocus' here, |
|
1876 |
"/ since we want to enforce it without giving the |
|
1877 |
"/ view a chance to circumvent this. |
|
1878 |
||
1879 |
"/ evView requestFocus. |
|
1880 |
self focusView:evView. |
|
3279
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1881 |
]. |
7825 | 1882 |
]. |
1883 |
||
1884 |
(busyHook notNil and:[busyHookBlock isNil]) ifTrue:[ |
|
1885 |
(event isKeyEvent or:[event isButtonPressEvent]) ifTrue:[ |
|
1886 |
"/ start a timeout action - to invoke the busyHook after some time |
|
1887 |
busyHookCalled := false. |
|
1888 |
busyHookBlock := [ |
|
1889 |
(inModalLoop ~~ true and:[busyHookCalled not]) ifTrue:[ |
|
1890 |
busyHook value:true. |
|
1891 |
busyHookCalled := true |
|
1892 |
] |
|
1893 |
]. |
|
1894 |
Processor |
|
1895 |
addTimedBlock:busyHookBlock |
|
1896 |
for:Processor timeoutHandlerProcess |
|
8309 | 1897 |
afterMilliseconds:(busyHookTimeout ? BusyHookTime). |
3279
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1898 |
]. |
7825 | 1899 |
]. |
1900 |
event isMessageSendEvent ifTrue:[ |
|
1901 |
"/ a synthetic event (delayed message) |
|
6023 | 1902 |
"/ cg: seems to not be a good idea (see modalLoopStarts): |
1903 |
"/ if in a modal-loop, do not process now, but repush onto the queue |
|
1904 |
"/ modalGroup notNil ifTrue:[ |
|
1905 |
"/ mySensor pushEvent:event |
|
1906 |
"/ ] ifFalse:[ |
|
7825 | 1907 |
event value |
6023 | 1908 |
"/ ] |
7825 | 1909 |
] ifFalse:[ |
1910 |
" |
|
1911 |
if there is no view information in the event, |
|
1912 |
it must have been sent directly to the sensor. |
|
1913 |
Send it to the first topView. |
|
1914 |
" |
|
1915 |
(evReceiver := evView) isNil ifTrue:[ |
|
1916 |
(firstTop := topViews first) notNil ifTrue:[ |
|
1917 |
event isApplicationEvent ifTrue:[ |
|
1918 |
evReceiver := firstTop application ? firstTop |
|
1919 |
] ifFalse:[ |
|
1920 |
evReceiver := firstTop. |
|
1921 |
]. |
|
1922 |
] |
|
1923 |
]. |
|
1924 |
evReceiver isNil ifTrue:[ |
|
1925 |
('WindowGroup [warning]: no receiver to dispatch ' , event type asString , '-event to. Ignored.') infoPrintCR. |
|
3279
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1926 |
] ifFalse:[ |
7825 | 1927 |
evReceiver dispatchEvent:event withFocusOn:focus delegate:true |
3096 | 1928 |
]. |
1929 |
]. |
|
7825 | 1930 |
]. |
1931 |
||
1932 |
"/ give eventRecorders, postProcessors |
|
1933 |
"/ a chance to see that event |
|
1934 |
self executePostEventHooksFor:event |
|
1935 |
] |
|
3096 | 1936 |
]. |
7825 | 1937 |
] "end while". |
8330 | 1938 |
] on:LastEventQuery do:[:ex | |
7825 | 1939 |
ex proceedWith:event |
3604
e32b5044a59e
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
3557
diff
changeset
|
1940 |
] ensure:[ |
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
1941 |
busyHookBlock notNil ifTrue:[ |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
1942 |
Processor removeTimedBlock:busyHookBlock. |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
1943 |
busyHookBlock := nil. |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
1944 |
busyHookCalled ifTrue:[ |
3281
95e6d0e98f92
care for modal dialogs in automatic busy cursor handling
Claus Gittinger <cg@exept.de>
parents:
3280
diff
changeset
|
1945 |
busyHook value:false. |
95e6d0e98f92
care for modal dialogs in automatic busy cursor handling
Claus Gittinger <cg@exept.de>
parents:
3280
diff
changeset
|
1946 |
busyHookCalled := false. |
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
1947 |
] |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
1948 |
]. |
3279
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1949 |
]. |
357
3655807445b7
keep track of pointerView, for implizit focus tracking
Claus Gittinger <cg@exept.de>
parents:
330
diff
changeset
|
1950 |
|
7825 | 1951 |
"Created: / 05-03-1997 / 11:33:11 / cg" |
1952 |
"Modified: / 04-08-1998 / 18:18:55 / cg" |
|
8330 | 1953 |
"Modified: / 11-04-2018 / 11:21:14 / stefan" |
1954 |
"Modified (format): / 11-04-2018 / 12:39:34 / stefan" |
|
3373
3585120d4d58
only eat a modal Escape-key event, if the modalView did unmap
Claus Gittinger <cg@exept.de>
parents:
3372
diff
changeset
|
1955 |
! |
48 | 1956 |
|
1957 |
processExposeEvents |
|
6861 | 1958 |
"process only pending expose events from the damage queue. |
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
1959 |
This also handles resize, mapped and unmap events." |
48 | 1960 |
|
2407 | 1961 |
self processExposeEventsFor:nil |
1962 |
||
1963 |
"Modified: / 3.12.1998 / 14:01:57 / cg" |
|
1964 |
! |
|
1965 |
||
1966 |
processExposeEventsFor:aViewOrNil |
|
6861 | 1967 |
"process only pending expose events from the damage queue. |
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
1968 |
This also handles resize, mapped and unmap events." |
2407 | 1969 |
|
8330 | 1970 |
|sensor| |
1971 |
||
8334 | 1972 |
(sensor := mySensor) isNil ifTrue:[^ self]. |
1973 |
sensor hasDamage ifFalse:[^ self]. |
|
1974 |
||
1975 |
WindowGroupQuery answer:self do:[ |
|
1976 |
|event view| |
|
1977 |
||
1978 |
[(event := sensor nextDamageEventFor:aViewOrNil) notNil] whileTrue:[ |
|
1979 |
(views notNil or:[topViews notNil]) ifTrue:[ |
|
1980 |
view := event view. |
|
1981 |
(aViewOrNil isNil or:[aViewOrNil == view]) ifTrue:[ |
|
1982 |
LastEventQuery answer:event do:[ |
|
1983 |
(self executePreEventHooksFor:event) ifFalse:[ |
|
1984 |
"/ |
|
1985 |
"/ if the view is no longer shown (iconified or closed), |
|
1986 |
"/ this is a leftover event and ignored. |
|
1987 |
"/ |
|
1988 |
"/ could this ever be a non-damage ? |
|
1989 |
"/ |
|
1990 |
(view notNil and:[view shown or:[event isDamage not]]) ifTrue:[ |
|
1991 |
view dispatchEvent:event withFocusOn:nil delegate:true. |
|
3096 | 1992 |
]. |
3511
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
1993 |
]. |
8334 | 1994 |
self executePostEventHooksFor:event. |
1995 |
]. |
|
3096 | 1996 |
] |
1997 |
] |
|
1998 |
] |
|
90 | 1999 |
] |
1157 | 2000 |
|
8330 | 2001 |
"Created: / 03-12-1998 / 14:01:39 / cg" |
2002 |
"Modified: / 05-02-1999 / 22:26:44 / cg" |
|
8334 | 2003 |
"Modified (format): / 13-04-2018 / 12:36:58 / stefan" |
11 | 2004 |
! |
2005 |
||
1806
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1752
diff
changeset
|
2006 |
processRealExposeEvents |
6861 | 2007 |
"process only pending expose events from the damage queue |
1806
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1752
diff
changeset
|
2008 |
(for any of my views). |
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
2009 |
This only handles true expose events - leaving map, unmap etc. in the queue. |
8450 | 2010 |
This is required before/after a scroll operation, |
1806
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1752
diff
changeset
|
2011 |
to wait for either a noExpose or a real expose." |
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1752
diff
changeset
|
2012 |
|
2093 | 2013 |
self processRealExposeEventsFor:nil |
8450 | 2014 |
|
2015 |
"Modified (comment): / 22-08-2018 / 10:10:10 / Claus Gittinger" |
|
2093 | 2016 |
! |
2017 |
||
2018 |
processRealExposeEventsFor:someViewOrNil |
|
6861 | 2019 |
"process only pending expose events from the damage queue |
2093 | 2020 |
(for any of my views if the arg is nil). |
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
2021 |
This only handles true expose events - leaving map, unmap etc. in the queue. |
8450 | 2022 |
This is required before/after a scroll operation, |
2093 | 2023 |
to wait for either a noExpose or a real expose." |
2024 |
||
7827 | 2025 |
|sensor| |
1806
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1752
diff
changeset
|
2026 |
|
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1752
diff
changeset
|
2027 |
(sensor := mySensor) isNil ifTrue:[^ self]. |
8334 | 2028 |
sensor hasDamage ifFalse:[^ self]. |
1806
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1752
diff
changeset
|
2029 |
|
8330 | 2030 |
WindowGroupQuery answer:self do:[ |
2031 |
|event| |
|
7827 | 2032 |
|
2033 |
[ |
|
7619 | 2034 |
"/ event := aView nextDamage. |
2035 |
event := sensor nextExposeEventFor:someViewOrNil. |
|
8330 | 2036 |
event isNil ifTrue:[ |
2037 |
^ self |
|
2038 |
]. |
|
7619 | 2039 |
|
2040 |
(views notNil or:[topViews notNil]) ifTrue:[ |
|
8330 | 2041 |
LastEventQuery answer:event do:[ |
2042 |
|view| |
|
2043 |
||
7619 | 2044 |
(self executePreEventHooksFor:event) ifFalse:[ |
2045 |
view := event view. |
|
2046 |
"/ |
|
2047 |
"/ if the view is no longer shown (iconified or closed), |
|
2048 |
"/ this is a leftover event and ignored. |
|
2049 |
"/ |
|
2050 |
view shown ifTrue:[ |
|
2051 |
view dispatchEvent:event withFocusOn:nil delegate:true. |
|
2052 |
] |
|
2053 |
]. |
|
2054 |
self executePostEventHooksFor:event. |
|
2055 |
] |
|
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
2056 |
] |
7827 | 2057 |
] loop. |
2058 |
]. |
|
2059 |
||
2060 |
"Created: / 02-07-1997 / 14:32:19 / cg" |
|
2061 |
"Modified: / 05-04-1998 / 11:35:43 / cg" |
|
8334 | 2062 |
"Modified: / 13-04-2018 / 12:29:20 / stefan" |
8450 | 2063 |
"Modified (comment): / 22-08-2018 / 10:10:22 / Claus Gittinger" |
1806
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1752
diff
changeset
|
2064 |
! |
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1752
diff
changeset
|
2065 |
|
2444 | 2066 |
repairDamage |
2067 |
"repair all damaged areas for any of my views right now." |
|
2068 |
||
2069 |
self processExposeEvents |
|
2070 |
||
2071 |
! |
|
2072 |
||
28 | 2073 |
waitForExposeFor:aView |
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
2074 |
"wait for an expose or noExpose event for aView, then process all exposes. |
500
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
2075 |
To be used after a scroll. |
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
2076 |
This is very X-specific and not needed with other systems |
500
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
2077 |
(i.e. a synthetic noExpose may be generated there)." |
28 | 2078 |
|
2079 |
mySensor waitForExposeFor:aView. |
|
4220 | 2080 |
AbortOperationRequest catch:[ |
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
2081 |
self processRealExposeEventsFor:aView |
90 | 2082 |
] |
500
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
2083 |
|
1851
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1822
diff
changeset
|
2084 |
"Modified: 6.8.1997 / 19:50:24 / cg" |
11 | 2085 |
! ! |
19 | 2086 |
|
90 | 2087 |
!WindowGroup methodsFor:'focus control'! |
2088 |
||
2691
26dd87552563
provide a hook for a defaultFocusWidget (not yet implemented)
Claus Gittinger <cg@exept.de>
parents:
2686
diff
changeset
|
2089 |
defaultKeyboardConsumer |
4180 | 2090 |
|view keyboardProcessor| |
2091 |
||
2092 |
view := self mainView. |
|
2093 |
view notNil ifTrue:[ |
|
2094 |
keyboardProcessor := view keyboardProcessor. |
|
2095 |
keyboardProcessor notNil ifTrue:[ |
|
2096 |
^ keyboardProcessor componentWithInitialFocus. |
|
2097 |
] |
|
2098 |
]. |
|
2691
26dd87552563
provide a hook for a defaultFocusWidget (not yet implemented)
Claus Gittinger <cg@exept.de>
parents:
2686
diff
changeset
|
2099 |
^ nil |
26dd87552563
provide a hook for a defaultFocusWidget (not yet implemented)
Claus Gittinger <cg@exept.de>
parents:
2686
diff
changeset
|
2100 |
! |
26dd87552563
provide a hook for a defaultFocusWidget (not yet implemented)
Claus Gittinger <cg@exept.de>
parents:
2686
diff
changeset
|
2101 |
|
2519 | 2102 |
explicitFocusView |
2103 |
"return the view which currently has the explicit (i.e. tabbed) focus" |
|
2104 |
||
2105 |
focusByTab == true ifFalse:[^ nil]. |
|
2106 |
^ focusView |
|
2107 |
! |
|
2108 |
||
6466 | 2109 |
focusBackToPreviousFocusView |
2110 |
"give focus to the view who had it before" |
|
2111 |
||
2112 |
previousFocusView notNil ifTrue:[ |
|
2113 |
previousFocusView isVisible ifTrue:[ |
|
6742 | 2114 |
"/ self focusToView:previousFocusView |
2115 |
self focusView:previousFocusView |
|
6466 | 2116 |
] |
2117 |
] |
|
2118 |
! |
|
2119 |
||
2517 | 2120 |
focusCameByTab |
6638 | 2121 |
^ focusByTab ? false |
2517 | 2122 |
! |
2123 |
||
6518 | 2124 |
focusMomentaryRelease |
2125 |
"release and reacquire focus. |
|
8042 | 2126 |
Use this to allow input fields with accept on lost focus |
6518 | 2127 |
to accept when a button or menu item is pressed" |
2128 |
||
2129 |
|oldFocusView| |
|
2130 |
||
6564 | 2131 |
"/ the problem was that the #focusToView: asked for canTab |
8042 | 2132 |
"/ what should not be done during restore (might answer false). |
6564 | 2133 |
|
6518 | 2134 |
oldFocusView := self focusView. |
6564 | 2135 |
oldFocusView isNil ifTrue:[^ self]. |
8042 | 2136 |
|
6564 | 2137 |
self focusView:nil. |
2138 |
||
2139 |
self focusView == oldFocusView ifTrue:[^ self]. |
|
2140 |
(oldFocusView shown and:[oldFocusView enabled]) ifTrue:[ |
|
2141 |
self focusView:oldFocusView. |
|
2142 |
]. |
|
2143 |
"/ self focusToView:nil. |
|
2144 |
"/ self focusToView:oldFocusView |
|
8042 | 2145 |
|
2146 |
"Modified (comment): / 30-05-2017 / 19:20:49 / mawalch" |
|
6518 | 2147 |
! |
2148 |
||
244 | 2149 |
focusNext |
6466 | 2150 |
"give focus to next view in the focusSequence from focusView or topView |
3156
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2151 |
" |
4733
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
2152 |
|curView oldView nxtView myTopViews| |
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
2153 |
|
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
2154 |
(myTopViews := topViews) isEmptyOrNil ifTrue:[ |
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
2155 |
self setFocusView:nil. |
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
2156 |
^ self |
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
2157 |
]. |
244 | 2158 |
|
3156
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2159 |
(curView := focusView) isNil ifTrue:[ |
4733
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
2160 |
myTopViews do:[:aView| |
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
2161 |
(aView shown and:[(nxtView := aView focusNext) notNil]) ifTrue:[ |
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
2162 |
^ self focusView:nxtView byTab:true |
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
2163 |
]. |
3156
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2164 |
]. |
4733
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
2165 |
^ self |
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
2166 |
]. |
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
2167 |
(nxtView := curView focusNext) notNil ifTrue:[ |
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
2168 |
self focusView:nxtView byTab:true. |
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
2169 |
^ self |
949
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
2170 |
]. |
4733
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
2171 |
self setFocusView:nil. |
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
2172 |
|
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
2173 |
[ oldView := curView. |
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
2174 |
(curView := curView superView) notNil |
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
2175 |
] whileTrue:[ |
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
2176 |
curView shown ifTrue:[ |
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
2177 |
nxtView := curView focusNextChildAfter:oldView. |
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
2178 |
nxtView notNil ifTrue:[ |
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
2179 |
^ self focusView:nxtView byTab:true |
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
2180 |
]. |
3156
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2181 |
]. |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2182 |
]. |
4733
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
2183 |
"/ ? should tab through the windowGroup ? |
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
2184 |
focusView isNil ifTrue:[ |
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
2185 |
self focusNext |
244 | 2186 |
]. |
2187 |
! |
|
2188 |
||
2219 | 2189 |
focusNextFrom:aView |
2190 |
"give focus to the view after aView in the focusSequence" |
|
2191 |
||
3486
f93691c57540
cleanup - single access to focusView
Claus Gittinger <cg@exept.de>
parents:
3459
diff
changeset
|
2192 |
self setFocusView:aView. |
2219 | 2193 |
self focusNext |
2194 |
||
2195 |
"Created: / 4.8.1998 / 02:43:17 / cg" |
|
2196 |
! |
|
2197 |
||
244 | 2198 |
focusPrevious |
6466 | 2199 |
"give focus to previous view in the focusSequence from focusView or topView |
3156
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2200 |
" |
4733
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
2201 |
|curView oldView nxtView subViews done| |
244 | 2202 |
|
3156
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2203 |
(curView := focusView) isNil ifTrue:[ |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2204 |
topViews notNil ifTrue:[ |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2205 |
curView := topViews detect:[:aView|aView shown] ifNone:nil. |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2206 |
] |
2479
2dbe1821533b
care for subWidgets when searching for the currentFocusView
Claus Gittinger <cg@exept.de>
parents:
2445
diff
changeset
|
2207 |
]. |
3156
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2208 |
curView isNil ifTrue:[^ self]. |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2209 |
|
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2210 |
focusView isNil ifTrue:[ |
4733
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
2211 |
subViews := curView subviewsInFocusOrder. |
3156
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2212 |
|
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2213 |
subViews size ~~ 0 ifTrue:[ |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2214 |
curView := subViews detectLast:[:v|v shown] ifNone:nil |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2215 |
]. |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2216 |
curView isNil ifTrue:[ |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2217 |
^ self focusToView:nil |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2218 |
]. |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2219 |
done := false. |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2220 |
|
4733
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
2221 |
[done not and:[(subViews := curView subviewsInFocusOrder) size ~~ 0]] whileTrue:[ |
3156
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2222 |
nxtView := subViews detectLast:[:v|v shown] ifNone:nil. |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2223 |
|
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2224 |
nxtView notNil ifTrue:[curView := nxtView] |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2225 |
ifFalse:[done := true]. |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2226 |
]. |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2227 |
|
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2228 |
(curView canTab and:[curView enabled]) ifTrue:[ |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2229 |
^ self focusView:curView byTab:true |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2230 |
]. |
3486
f93691c57540
cleanup - single access to focusView
Claus Gittinger <cg@exept.de>
parents:
3459
diff
changeset
|
2231 |
self setFocusView:curView. |
3156
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2232 |
] ifFalse:[ |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2233 |
nxtView := focusView. |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2234 |
"/ check whether all superView's are shown |
949
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
2235 |
|
3156
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2236 |
[(nxtView := nxtView superView) notNil] whileTrue:[ |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2237 |
nxtView shown ifFalse:[ |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2238 |
curView := nxtView superView |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2239 |
] |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2240 |
]. |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2241 |
curView ~~ focusView ifTrue:[ |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2242 |
curView isNil ifTrue:[ |
3486
f93691c57540
cleanup - single access to focusView
Claus Gittinger <cg@exept.de>
parents:
3459
diff
changeset
|
2243 |
self setFocusView:nil. |
3156
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2244 |
self focusPrevious. |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2245 |
] ifFalse:[ |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2246 |
self focusView:curView byTab:true |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2247 |
]. |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2248 |
^ self |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2249 |
]. |
3486
f93691c57540
cleanup - single access to focusView
Claus Gittinger <cg@exept.de>
parents:
3459
diff
changeset
|
2250 |
self setFocusView:nil. |
3156
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2251 |
]. |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2252 |
|
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2253 |
[true] whileTrue:[ |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2254 |
oldView := curView. |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2255 |
curView := curView superView. |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2256 |
|
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2257 |
curView isNil ifTrue:[ |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2258 |
focusView notNil ifTrue:[ |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2259 |
^ self |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2260 |
]. |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2261 |
^ self focusPrevious |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2262 |
]. |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2263 |
|
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2264 |
curView shown ifTrue:[ |
4733
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
2265 |
nxtView := curView focusPreviousChildBefore:oldView. |
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
2266 |
nxtView notNil ifTrue:[ |
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
2267 |
^ self focusView:nxtView byTab:true |
3156
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2268 |
]. |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2269 |
]. |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2270 |
]. |
244 | 2271 |
! |
2272 |
||
2219 | 2273 |
focusPreviousFrom:aView |
2274 |
"give focus to the view before aView in the focusSequence" |
|
2275 |
||
3486
f93691c57540
cleanup - single access to focusView
Claus Gittinger <cg@exept.de>
parents:
3459
diff
changeset
|
2276 |
self setFocusView:aView. |
2219 | 2277 |
self focusPrevious |
2278 |
||
2279 |
"Created: / 4.8.1998 / 02:43:08 / cg" |
|
2280 |
! |
|
2281 |
||
2506 | 2282 |
focusRequestFrom:aView |
2283 |
"aView requests focus. I will grant it, if I have no explicit |
|
2284 |
focusView (i.e. not tabbed)" |
|
2285 |
||
3651 | 2286 |
|prevFocusView myDisplay| |
2686
f074aa7d0748
care for activateOnClick mode when granting a focusRequest.
Claus Gittinger <cg@exept.de>
parents:
2644
diff
changeset
|
2287 |
|
2692 | 2288 |
"/ 'focusRequest:' print. aView print. |
2289 |
||
2686
f074aa7d0748
care for activateOnClick mode when granting a focusRequest.
Claus Gittinger <cg@exept.de>
parents:
2644
diff
changeset
|
2290 |
myDisplay := self graphicsDevice. |
3651 | 2291 |
(myDisplay notNil and:[myDisplay activateOnClick:nil]) ifTrue:[ |
3400 | 2292 |
prevFocusView := myDisplay focusView. |
2293 |
(prevFocusView notNil |
|
3651 | 2294 |
and:[prevFocusView windowGroup ~~ aView windowGroup]) ifTrue:[ |
3400 | 2295 |
"/ a view from another windowGroup requests the focus. |
2296 |
"/ Do not grant this, if in windows-activateOnClick mode. |
|
2686
f074aa7d0748
care for activateOnClick mode when granting a focusRequest.
Claus Gittinger <cg@exept.de>
parents:
2644
diff
changeset
|
2297 |
|
2692 | 2298 |
"/ ' not granted' printCR. |
3657 | 2299 |
|
2300 |
"/ check this - must be commented for windows |
|
2301 |
"/ prevFocusView getKeyboardFocus. |
|
3400 | 2302 |
^ false |
2303 |
]. |
|
2686
f074aa7d0748
care for activateOnClick mode when granting a focusRequest.
Claus Gittinger <cg@exept.de>
parents:
2644
diff
changeset
|
2304 |
]. |
f074aa7d0748
care for activateOnClick mode when granting a focusRequest.
Claus Gittinger <cg@exept.de>
parents:
2644
diff
changeset
|
2305 |
|
2692 | 2306 |
"/ ' granted' printCR. |
2307 |
||
2506 | 2308 |
(focusView isNil or:[focusByTab not]) ifTrue:[ |
3400 | 2309 |
(aView isNil or:[aView ~~ focusView]) ifTrue:[ |
6141 | 2310 |
self focusView:aView byTab:false. "/ do not change to true - focus followsMouse will no longer work then |
3400 | 2311 |
]. |
2312 |
^ true |
|
2506 | 2313 |
]. |
2314 |
^ false |
|
2686
f074aa7d0748
care for activateOnClick mode when granting a focusRequest.
Claus Gittinger <cg@exept.de>
parents:
2644
diff
changeset
|
2315 |
|
2692 | 2316 |
"Modified: / 20.5.1999 / 18:30:31 / cg" |
2506 | 2317 |
! |
2318 |
||
90 | 2319 |
focusSequence:aSequenceableCollection |
2320 |
"define the focus sequence for focusNext/focusPrevious. |
|
2321 |
Focus is stepped in the order in which subviews occur in |
|
1946 | 2322 |
the sequence." |
90 | 2323 |
! |
2324 |
||
2353
e04098201f7c
added #focusToView: - checks if its a valid view in the focusSequence.
Claus Gittinger <cg@exept.de>
parents:
2250
diff
changeset
|
2325 |
focusToView:aViewOrNil |
3156
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2326 |
"give focus to aViewOrNil" |
2353
e04098201f7c
added #focusToView: - checks if its a valid view in the focusSequence.
Claus Gittinger <cg@exept.de>
parents:
2250
diff
changeset
|
2327 |
|
e04098201f7c
added #focusToView: - checks if its a valid view in the focusSequence.
Claus Gittinger <cg@exept.de>
parents:
2250
diff
changeset
|
2328 |
focusView == aViewOrNil ifFalse:[ |
4943 | 2329 |
(aViewOrNil isNil |
3156
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2330 |
or:[(aViewOrNil canTab and:[aViewOrNil enabled])] |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2331 |
) ifTrue:[ |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2332 |
self focusView:aViewOrNil |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2333 |
] |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2334 |
]. |
2353
e04098201f7c
added #focusToView: - checks if its a valid view in the focusSequence.
Claus Gittinger <cg@exept.de>
parents:
2250
diff
changeset
|
2335 |
! |
e04098201f7c
added #focusToView: - checks if its a valid view in the focusSequence.
Claus Gittinger <cg@exept.de>
parents:
2250
diff
changeset
|
2336 |
|
90 | 2337 |
focusView |
135 | 2338 |
"return the view which currently has the focus" |
90 | 2339 |
|
2340 |
^ focusView |
|
2341 |
! |
|
2342 |
||
2343 |
focusView:aViewOrNil |
|
2344 |
"give focus to aViewOrNil" |
|
2345 |
||
2485
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
2346 |
self focusView:aViewOrNil byTab:false |
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
2347 |
|
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
2348 |
" |
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
2349 |
|top v1 v2| |
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
2350 |
|
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
2351 |
top := StandardSystemView new. |
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
2352 |
v1 := EditTextView origin:0.0@0.0 corner:1.0@0.5 in:top. |
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
2353 |
v2 := EditTextView origin:0.0@0.5 corner:1.0@1.0 in:top. |
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
2354 |
top open. |
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
2355 |
top windowGroup focusView:v1. |
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
2356 |
" |
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
2357 |
|
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
2358 |
"Modified: 31.5.1996 / 21:13:25 / cg" |
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
2359 |
! |
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
2360 |
|
5003 | 2361 |
focusView:aViewOrNil byTab:focusCameViaTabOrNil |
2507 | 2362 |
"give focus to aViewOrNil. |
5003 | 2363 |
The focusCameViaTabOrNil argument specifies if the focus came via |
2364 |
tabbing or by pointer-movement/automatic or (if nil) by reassigning the topView focus |
|
2365 |
to the windowGroup which had it before. |
|
2507 | 2366 |
If it came via tabbing, the view is notified differently, to allow |
6141 | 2367 |
for special highlighting (i.e. drawing a focus-border around itself). |
2368 |
Also, if tabbed in, the focusFollowsMouse behavior is disabled (as we assume, |
|
2369 |
that the user has explicitely tabbed into the view to force focus to it)" |
|
2485
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
2370 |
|
3652 | 2371 |
|prevFocusView myDisplay| |
6744 | 2372 |
"/(aViewOrNil notNil and:[aViewOrNil shown not]) ifTrue:[ |
2373 |
"/aViewOrNil topView shown ifTrue:[self halt]. |
|
2374 |
"/]. |
|
2506 | 2375 |
|
6125 | 2376 |
"/'focusToView:' print. aViewOrNil print. |
2377 |
"/' (prev: ' print. focusView print. ')' printCR. |
|
2692 | 2378 |
|
2507 | 2379 |
myDisplay := self graphicsDevice. |
2522 | 2380 |
myDisplay notNil ifTrue:[ |
3376 | 2381 |
"/ |
2382 |
"/ take the focus from whichEver view had it previously |
|
2383 |
"/ |
|
2384 |
prevFocusView := myDisplay focusView. |
|
2385 |
prevFocusView ~~ aViewOrNil ifTrue:[ |
|
6125 | 2386 |
"/'take focus from ' print. prevFocusView printCR. |
3376 | 2387 |
self class takeFocusFromDevice:myDisplay. |
2388 |
]. |
|
2506 | 2389 |
]. |
2390 |
||
4677 | 2391 |
myDisplay focusView:aViewOrNil. |
4676 | 2392 |
|
2485
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
2393 |
focusView == aViewOrNil ifTrue:[ |
3376 | 2394 |
focusView notNil ifTrue:[ |
2395 |
"/ this is the case when the mouse-pointer reenters |
|
2396 |
"/ into a topView which had a focusView |
|
4973 | 2397 |
"/ cg: disabled 5.jun.08 |
5003 | 2398 |
focusCameViaTabOrNil notNil ifTrue:[ |
2399 |
focusByTab := focusCameViaTabOrNil "or:[focusByTab]". |
|
2400 |
]. |
|
6742 | 2401 |
true ifTrue:[ |
6125 | 2402 |
focusView showFocus:focusByTab. |
6742 | 2403 |
]. |
2404 |
true ifTrue:[ |
|
6745 | 2405 |
"/ 'give focus to ' print. aViewOrNil printCR. |
6125 | 2406 |
self class sendKeyboardFocusEventTo:aViewOrNil withArgument:true. |
2407 |
]. |
|
3376 | 2408 |
]. |
2409 |
^ self |
|
2485
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
2410 |
]. |
410
9d9d03fa5d82
moved Tab handling to topView (which sends #focusNext if no subview handled it)
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2411 |
|
90 | 2412 |
focusView notNil ifTrue:[ |
3376 | 2413 |
"/ lost explicit focus |
2414 |
focusView == aViewOrNil ifTrue:[ |
|
6125 | 2415 |
"/'give focus to ' print. aViewOrNil printCR. |
6742 | 2416 |
aViewOrNil showFocus:(focusCameViaTabOrNil ? true). |
3376 | 2417 |
self class sendKeyboardFocusEventTo:aViewOrNil withArgument:true. |
2418 |
^ self |
|
2419 |
]. |
|
90 | 2420 |
]. |
387
aa80487842b8
compile event classes with optSpace;
Claus Gittinger <cg@exept.de>
parents:
385
diff
changeset
|
2421 |
|
3486
f93691c57540
cleanup - single access to focusView
Claus Gittinger <cg@exept.de>
parents:
3459
diff
changeset
|
2422 |
self setFocusView:aViewOrNil. |
90 | 2423 |
focusView notNil ifTrue:[ |
3376 | 2424 |
"/ got explicit focus |
5003 | 2425 |
aViewOrNil showFocus:(focusCameViaTabOrNil ? true). |
6125 | 2426 |
"/'give focus to ' print. aViewOrNil printCR. |
3376 | 2427 |
self class sendKeyboardFocusEventTo:aViewOrNil withArgument:true. |
5003 | 2428 |
focusCameViaTabOrNil notNil ifTrue:[ |
2429 |
focusByTab := focusCameViaTabOrNil. |
|
2430 |
] |
|
90 | 2431 |
]. |
2432 |
||
2433 |
" |
|
2434 |
|top v1 v2| |
|
2435 |
||
2436 |
top := StandardSystemView new. |
|
2437 |
v1 := EditTextView origin:0.0@0.0 corner:1.0@0.5 in:top. |
|
2438 |
v2 := EditTextView origin:0.0@0.5 corner:1.0@1.0 in:top. |
|
2439 |
top open. |
|
2440 |
top windowGroup focusView:v1. |
|
2441 |
" |
|
357
3655807445b7
keep track of pointerView, for implizit focus tracking
Claus Gittinger <cg@exept.de>
parents:
330
diff
changeset
|
2442 |
|
5676 | 2443 |
"Modified: / 20-01-2011 / 22:39:57 / cg" |
2479
2dbe1821533b
care for subWidgets when searching for the currentFocusView
Claus Gittinger <cg@exept.de>
parents:
2445
diff
changeset
|
2444 |
! |
2dbe1821533b
care for subWidgets when searching for the currentFocusView
Claus Gittinger <cg@exept.de>
parents:
2445
diff
changeset
|
2445 |
|
4737 | 2446 |
focusViewUnmapped |
2447 |
"the view which currently had the focus was unmapped" |
|
2448 |
||
2449 |
self focusView:nil |
|
2450 |
! |
|
2451 |
||
2737 | 2452 |
pointerView |
2453 |
"return the view which currently has the pointer" |
|
2454 |
||
2455 |
^ pointerView |
|
3486
f93691c57540
cleanup - single access to focusView
Claus Gittinger <cg@exept.de>
parents:
3459
diff
changeset
|
2456 |
! |
f93691c57540
cleanup - single access to focusView
Claus Gittinger <cg@exept.de>
parents:
3459
diff
changeset
|
2457 |
|
f93691c57540
cleanup - single access to focusView
Claus Gittinger <cg@exept.de>
parents:
3459
diff
changeset
|
2458 |
setFocusView:aViewOrNil |
6147 | 2459 |
focusView notNil ifTrue:[ |
2460 |
self class sendKeyboardFocusEventTo:focusView withArgument:false |
|
2461 |
]. |
|
6466 | 2462 |
previousFocusView := focusView. |
6147 | 2463 |
focusView := aViewOrNil. |
2464 |
focusView notNil ifTrue:[ |
|
2465 |
self class sendKeyboardFocusEventTo:focusView withArgument:true |
|
2466 |
]. |
|
244 | 2467 |
! ! |
2468 |
||
2469 |
!WindowGroup methodsFor:'initialization'! |
|
2470 |
||
3683 | 2471 |
beSynchronous |
2472 |
mySensor := SynchronousWindowSensor new. |
|
2473 |
! |
|
2474 |
||
244 | 2475 |
initialize |
2476 |
"setup the windowgroup, by creating a new sensor |
|
2477 |
and an event semaphore" |
|
2478 |
||
2479 |
mySensor := WindowSensor new. |
|
8066 | 2480 |
mySensor eventSemaphore:(Semaphore name:'WGroup eventSema'). |
4375
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2481 |
processPriority := Processor userSchedulingPriority. |
244 | 2482 |
isModal := false. |
417 | 2483 |
isForModalSubview := false. |
5520 | 2484 |
doNotCloseOnAbortSignal := false. |
1273 | 2485 |
|
8066 | 2486 |
"Modified: / 09-08-2017 / 12:00:17 / cg" |
90 | 2487 |
! |
2488 |
||
244 | 2489 |
reinitialize |
2490 |
"reinitialize the windowgroup after an image restart" |
|
90 | 2491 |
|
244 | 2492 |
"throw away old (zombie) process" |
2493 |
myProcess notNil ifTrue:[ |
|
3683 | 2494 |
"/ careful: the old processes exit-actions must be cleared. |
2495 |
"/ otherwise, it might do destroy or other actions when it |
|
2496 |
"/ gets finalized ... |
|
1186
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
2497 |
|
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
2498 |
"/ myProcess removeAllExitActions. |
3683 | 2499 |
myProcess removeAllSuspendActions. |
4375
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2500 |
processPriority := myProcess priority. "save old priority" |
3683 | 2501 |
myProcess := nil. |
244 | 2502 |
]. |
90 | 2503 |
|
5918 | 2504 |
inWithCursorDoBlock := false. |
2505 |
||
244 | 2506 |
"throw away old events" |
3683 | 2507 |
mySensor notNil ifTrue:[mySensor reinitialize] |
313 | 2508 |
|
2509 |
"Modified: 13.12.1995 / 13:45:35 / stefan" |
|
1186
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
2510 |
"Modified: 12.1.1997 / 00:45:01 / cg" |
4375
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2511 |
! |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2512 |
|
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2513 |
setProcessNameWithRedirectIndicator:redirectString |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2514 |
"give the windowGroup process a user friendly name. |
5291 | 2515 |
This name shows up in the ProcessMonitor. |
2516 |
redirectString is nonEmpty, for remote display views" |
|
4375
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2517 |
|
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2518 |
|top nm dev devNm defaultDisplay| |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2519 |
|
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2520 |
"ask my topView for the processName, and |
7889 | 2521 |
optionally append the displayName (if it's not the default)" |
4375
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2522 |
|
7984 | 2523 |
topViews notEmptyOrNil ifTrue:[ |
4375
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2524 |
top := topViews first. |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2525 |
nm := top processName. |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2526 |
|
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2527 |
dev := top graphicsDevice. |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2528 |
defaultDisplay := Screen default. |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2529 |
(dev notNil and:[dev ~~ defaultDisplay]) ifTrue:[ |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2530 |
devNm := dev displayName. |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2531 |
(devNm notNil and:[defaultDisplay isNil or:[devNm ~= defaultDisplay displayName]]) ifTrue:[ |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2532 |
nm := nm , ' (' , redirectString , devNm , ')' |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2533 |
] |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2534 |
] |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2535 |
] ifFalse:[ |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2536 |
nm := 'window handler'. |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2537 |
]. |
7440 | 2538 |
myProcess notNil ifTrue:[ |
2539 |
myProcess name:nm. |
|
2540 |
]. |
|
7889 | 2541 |
|
2542 |
"Modified (format): / 13-02-2017 / 20:34:28 / cg" |
|
7984 | 2543 |
"Modified: / 17-03-2017 / 16:55:19 / stefan" |
90 | 2544 |
! ! |
2545 |
||
3372 | 2546 |
!WindowGroup methodsFor:'keyboard control'! |
2547 |
||
3391 | 2548 |
processMnemonic:aKeyEvent |
3372 | 2549 |
"a mnemonicKey event as forwarded from the keyboardProcessor - if there |
3822 | 2550 |
is the mnemonic-key defined for a subView, true is returned and the view |
2551 |
becomes the focusView. Otherwise return false. |
|
3372 | 2552 |
" |
2553 |
|topView mnemonicView| |
|
2554 |
||
2555 |
focusView notNil ifTrue:[ |
|
2556 |
"/ start from current focusView |
|
2557 |
mnemonicView := focusView mnemonicViewNext:aKeyEvent. |
|
2558 |
||
3391 | 2559 |
(mnemonicView notNil and:[true "mnemonicView canTab" and:[mnemonicView enabled]]) ifTrue:[ |
3372 | 2560 |
self focusView:mnemonicView byTab:false. |
3822 | 2561 |
^ true |
3372 | 2562 |
] |
2563 |
]. |
|
2564 |
||
2565 |
"/ start from any topview |
|
2566 |
topViews notNil ifTrue:[ |
|
2567 |
topView := topViews detect:[:aView| aView shown ] ifNone:nil. |
|
2568 |
||
2569 |
topView notNil ifTrue:[ |
|
2570 |
mnemonicView := topView mnemonicViewNext:aKeyEvent. |
|
2571 |
||
3391 | 2572 |
(mnemonicView notNil and:[true "mnemonicView canTab" and:[mnemonicView enabled]]) ifTrue:[ |
3372 | 2573 |
self focusView:mnemonicView byTab:false. |
3822 | 2574 |
^ true |
3372 | 2575 |
] |
2576 |
] |
|
2577 |
]. |
|
3376 | 2578 |
^ false |
2579 |
! |
|
3372 | 2580 |
|
2581 |
processShortcut:aKeyEvent |
|
3652 | 2582 |
"a shortcut key event as forwarded from the keyboardProcessor - if there is the |
4943 | 2583 |
shortcut key defined, process the shortcut and return true - otherwise false." |
2584 |
||
3652 | 2585 |
|topView| |
3372 | 2586 |
|
2587 |
"/ start from current focusView |
|
2588 |
(focusView notNil and:[focusView processShortcut:aKeyEvent]) ifTrue:[ |
|
2589 |
^ true |
|
2590 |
]. |
|
2591 |
||
2592 |
"/ start from any topview |
|
2593 |
topViews notNil ifTrue:[ |
|
2594 |
topView := topViews detect:[:v| v ~~ focusView and:[v shown]] ifNone:nil. |
|
4943 | 2595 |
^ topView notNil and:[topView processShortcut:aKeyEvent] |
3372 | 2596 |
]. |
3376 | 2597 |
^ false |
2598 |
! ! |
|
3372 | 2599 |
|
3276 | 2600 |
!WindowGroup methodsFor:'printing & storing'! |
19 | 2601 |
|
90 | 2602 |
printOn:aStream |
19 | 2603 |
"return a printed representation; |
144 | 2604 |
just for more user friendlyness: add name of process." |
19 | 2605 |
|
90 | 2606 |
myProcess isNil ifTrue:[ |
3077 | 2607 |
(previousGroup notNil and:[previousGroup process notNil]) ifTrue:[ |
2608 |
aStream nextPutAll:('WindowGroup(modal in ' , previousGroup process nameOrId , ')'). |
|
2609 |
^ self. |
|
2610 |
]. |
|
2611 |
^ super printOn:aStream |
|
2870 | 2612 |
]. |
2613 |
isModal ifTrue:[ |
|
3077 | 2614 |
aStream nextPutAll:('WindowGroup(modal for ' , myProcess nameOrId , ')'). |
2615 |
^ self. |
|
90 | 2616 |
]. |
2617 |
aStream nextPutAll:('WindowGroup(' , myProcess nameOrId , ')') |
|
19 | 2618 |
! ! |
244 | 2619 |
|
4962 | 2620 |
!WindowGroup methodsFor:'queries'! |
2621 |
||
2622 |
anyViewHasFocus |
|
5948 | 2623 |
|focusVw| |
2624 |
||
4962 | 2625 |
^ graphicsDevice notNil |
5948 | 2626 |
and:[ (focusVw := graphicsDevice focusView) notNil |
2627 |
and:[ focusVw windowGroup == self ]] |
|
4962 | 2628 |
! |
2629 |
||
2630 |
isPopUp |
|
2631 |
"return true, if the receiver is for a popUp view" |
|
2632 |
||
2633 |
isModal ifFalse:[^ false]. |
|
2634 |
topViews isNil ifTrue:[^ true]. "/ a closed popup ... |
|
2635 |
^ topViews first isPopUpView |
|
2636 |
||
2637 |
"Created: / 9.7.1998 / 01:13:01 / cg" |
|
2638 |
"Modified: / 9.7.1998 / 01:17:11 / cg" |
|
2639 |
! ! |
|
2640 |
||
244 | 2641 |
!WindowGroup methodsFor:'special'! |
2642 |
||
3293
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2643 |
migrateTo:anotherDisplay |
3302 | 2644 |
"migrate all of my views to some other display device" |
3293
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2645 |
|
4375
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2646 |
|myDevice previouslyRealized| |
3293
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2647 |
|
3304
6dcc6bb7c3e5
block migration of a modalBox
Claus Gittinger <cg@exept.de>
parents:
3302
diff
changeset
|
2648 |
self isModal ifTrue:[ |
6dcc6bb7c3e5
block migration of a modalBox
Claus Gittinger <cg@exept.de>
parents:
3302
diff
changeset
|
2649 |
"/ cannot migrate a modal box away from its owner ... |
6dcc6bb7c3e5
block migration of a modalBox
Claus Gittinger <cg@exept.de>
parents:
3302
diff
changeset
|
2650 |
"/ (need a separate process and views may not be owned) |
4348 | 2651 |
Transcript showCR:'Modal windogroup cannot be migrated.'. |
2652 |
"/ self error:'Modal windogroup cannot be migrated.'. |
|
3304
6dcc6bb7c3e5
block migration of a modalBox
Claus Gittinger <cg@exept.de>
parents:
3302
diff
changeset
|
2653 |
^ self |
6dcc6bb7c3e5
block migration of a modalBox
Claus Gittinger <cg@exept.de>
parents:
3302
diff
changeset
|
2654 |
]. |
6dcc6bb7c3e5
block migration of a modalBox
Claus Gittinger <cg@exept.de>
parents:
3302
diff
changeset
|
2655 |
|
3293
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2656 |
previouslyRealized := IdentitySet new. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2657 |
|
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2658 |
myDevice := self graphicsDevice. |
3308 | 2659 |
DeviceWorkstation flushCachedLastScreen. |
3293
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2660 |
|
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2661 |
graphicsDevice := nil. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2662 |
|
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2663 |
"/ enumerate views - flush their device info ... |
3841
39b293125434
care for 'migrate back' pressed without any topViews left (closed before).
martin
parents:
3822
diff
changeset
|
2664 |
self allTopViewsDo:[:eachTopView | |
3293
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2665 |
eachTopView realized ifTrue:[ |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2666 |
previouslyRealized add:eachTopView |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2667 |
]. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2668 |
eachTopView unmap. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2669 |
]. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2670 |
|
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2671 |
"/ destroy them - but without notifying application/views |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2672 |
self allViewsDo:[:eachView | |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2673 |
eachView releaseDeviceResources. |
3302 | 2674 |
eachView setDevice:anotherDisplay id:nil gcId:nil. |
3293
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2675 |
]. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2676 |
|
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2677 |
"/ recreate them ... |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2678 |
self allViewsDo:[:eachView | |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2679 |
eachView recreate. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2680 |
eachView fetchDeviceResources |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2681 |
]. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2682 |
|
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2683 |
"/ realize them ... |
3304
6dcc6bb7c3e5
block migration of a modalBox
Claus Gittinger <cg@exept.de>
parents:
3302
diff
changeset
|
2684 |
(topViews ? previouslyRealized) do:[:eachTopView | |
3293
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2685 |
(previouslyRealized includes:eachTopView) ifTrue:[ |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2686 |
eachTopView realize |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2687 |
]. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2688 |
]. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2689 |
|
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2690 |
graphicsDevice := anotherDisplay. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2691 |
|
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2692 |
anotherDisplay sync. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2693 |
myDevice sync. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2694 |
|
4375
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2695 |
|
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2696 |
"change the name of my process" |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2697 |
self setProcessNameWithRedirectIndicator:'->'. |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2698 |
|
3293
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2699 |
|
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2700 |
" |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2701 |
|anotherDisplay v host| |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2702 |
|
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2703 |
v := StandardSystemView new. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2704 |
v extent:100@100. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2705 |
v addSubView:(Button label:'foo'). |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2706 |
v openAndWait. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2707 |
|
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2708 |
host := Dialog request:'display:' initialAnswer:'dawn:0'. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2709 |
host isNil ifTrue:[^ self]. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2710 |
|
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2711 |
anotherDisplay := XWorkstation newDispatchingFor:host. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2712 |
anotherDisplay isNil ifTrue:[ |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2713 |
self warn:'Could not connect to remote display'. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2714 |
^ self |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2715 |
]. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2716 |
Smalltalk at:#Display2 put:anotherDisplay. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2717 |
|
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2718 |
v windowGroup migrateTo:anotherDisplay |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2719 |
" |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2720 |
|
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2721 |
" |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2722 |
|anotherDisplay app host| |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2723 |
|
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2724 |
app := NewSystemBrowser open. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2725 |
app window waitUntilVisible. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2726 |
|
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2727 |
host := Dialog request:'display:' initialAnswer:'dawn:0'. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2728 |
host isNil ifTrue:[^ self]. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2729 |
|
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2730 |
anotherDisplay := XWorkstation newDispatchingFor:host. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2731 |
anotherDisplay isNil ifTrue:[ |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2732 |
self warn:'Could not connect to remote display'. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2733 |
^ self |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2734 |
]. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2735 |
Smalltalk at:#Display2 put:anotherDisplay. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2736 |
|
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2737 |
app windowGroup migrateTo:anotherDisplay |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2738 |
" |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2739 |
|
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2740 |
" |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2741 |
|host anotherDisplay| |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2742 |
|
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2743 |
host := Dialog request:'display:' initialAnswer:'dawn:0'. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2744 |
host isNil ifTrue:[^ self]. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2745 |
|
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2746 |
anotherDisplay := XWorkstation newDispatchingFor:host. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2747 |
anotherDisplay isNil ifTrue:[ |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2748 |
self warn:'Could not connect to remote display'. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2749 |
^ self |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2750 |
]. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2751 |
Smalltalk at:#Display2 put:anotherDisplay. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2752 |
|
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2753 |
Transcript topView windowGroup migrateTo:anotherDisplay |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2754 |
" |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2755 |
|
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2756 |
" |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2757 |
Transcript topView windowGroup migrateTo:Display |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2758 |
" |
3302 | 2759 |
! ! |
2760 |
||
2761 |
!WindowGroup methodsFor:'special-accessing'! |
|
2762 |
||
2763 |
isForModalSubview |
|
7676 | 2764 |
"special for windowgroup with modal subviews. |
3302 | 2765 |
These must be flagged specially to avoid the views being reassigned |
2766 |
to the maingroup. |
|
2767 |
This is a private interface to the SimpleView class" |
|
2768 |
||
2769 |
^ isForModalSubview |
|
7676 | 2770 |
|
2771 |
"Modified (comment): / 13-11-2016 / 17:09:18 / cg" |
|
3293
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2772 |
! |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2773 |
|
3302 | 2774 |
isForModalSubview:aBoolean |
7676 | 2775 |
"special for windowgroups with modal subviews. |
3302 | 2776 |
These must be flagged specially to avoid the views being reassigned |
2777 |
to the maingroup. |
|
2778 |
This is a private interface to the SimpleView class" |
|
2779 |
||
2780 |
isForModalSubview := aBoolean |
|
7676 | 2781 |
|
2782 |
"Modified (comment): / 13-11-2016 / 17:09:22 / cg" |
|
3302 | 2783 |
! |
2784 |
||
2785 |
setModal:aBoolean |
|
2786 |
"special entry for debugger: set the modal flag. |
|
2787 |
Not for public use" |
|
2788 |
||
2789 |
isModal := aBoolean |
|
2790 |
||
2791 |
"Modified: 3.9.1995 / 14:51:04 / claus" |
|
2792 |
! |
|
2793 |
||
2794 |
setPreviousGroup:aGroup |
|
2795 |
"special entry for debugger: |
|
2796 |
set the windowgroup that started this group (for modal groups only). |
|
2797 |
This is not a public interface." |
|
2798 |
||
6118 | 2799 |
self assert:(aGroup ~~ self). |
3302 | 2800 |
previousGroup := aGroup |
2801 |
||
2802 |
"Modified: 3.9.1995 / 14:55:40 / claus" |
|
2803 |
! |
|
2804 |
||
2805 |
setProcess:aProcess |
|
2806 |
"special entry for debugger: set the windowGroups process. |
|
2807 |
Not for public use." |
|
2808 |
||
2809 |
myProcess := aProcess |
|
2810 |
||
2811 |
"Modified: 3.9.1995 / 14:25:38 / claus" |
|
2812 |
! ! |
|
2813 |
||
2814 |
!WindowGroup methodsFor:'special-user interaction'! |
|
2815 |
||
244 | 2816 |
restoreCursors |
2817 |
"restore the original cursors in all of my views" |
|
2818 |
||
3288
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2819 |
|myDevice| |
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2820 |
|
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2821 |
myDevice := self graphicsDevice. |
8460 | 2822 |
myDevice isOpen ifFalse:[ |
2823 |
^ self. |
|
2824 |
]. |
|
3288
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2825 |
|
330
13a3fa93330c
careful - view could have been destroyed in the meanwhile (in restoreCursors)
Claus Gittinger <cg@exept.de>
parents:
329
diff
changeset
|
2826 |
self allViewsDo:[:aView | |
3288
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2827 |
|c dev id cid| |
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2828 |
|
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2829 |
dev := aView graphicsDevice. |
8460 | 2830 |
(dev notNil and:[dev isOpen]) ifTrue:[ |
3288
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2831 |
(id := aView id) notNil ifTrue:[ |
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2832 |
c := aView cursor. |
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2833 |
c notNil ifTrue:[ |
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2834 |
c := c onDevice:dev. |
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2835 |
(c notNil and:[(cid := c id) notNil]) ifTrue:[ |
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2836 |
dev setCursor:cid in:id. |
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2837 |
dev ~~ myDevice ifTrue:[ |
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2838 |
dev flush |
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2839 |
] |
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2840 |
]. |
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2841 |
] |
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2842 |
] |
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2843 |
] |
244 | 2844 |
]. |
3288
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2845 |
myDevice flush |
743 | 2846 |
|
8460 | 2847 |
"Modified: / 22-04-1998 / 14:28:22 / cg" |
2848 |
"Modified: / 10-09-2018 / 15:40:38 / Stefan Vogel" |
|
244 | 2849 |
! |
2850 |
||
328 | 2851 |
showActivity:someMessage |
597 | 2852 |
"some activityNotification shalt be communicated to |
2853 |
the user; |
|
2854 |
forward it to my first topView if there is one |
|
2855 |
(that one should know how to deal with it)" |
|
2856 |
||
328 | 2857 |
topViews notNil ifTrue:[ |
1977
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
2858 |
topViews first showActivity:someMessage |
328 | 2859 |
] |
2860 |
||
2861 |
"Created: 16.12.1995 / 18:39:40 / cg" |
|
597 | 2862 |
"Modified: 23.4.1996 / 21:36:54 / cg" |
328 | 2863 |
! |
2864 |
||
244 | 2865 |
showCursor:aCursor |
3280 | 2866 |
"change the cursor to aCursor in all of my views |
2867 |
(This sets the cursor directly, without changing the state of the cursor instance variable; |
|
2868 |
the reason is to allow for #restoreCursors to be able to undo this)." |
|
244 | 2869 |
|
3288
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2870 |
|myDevice c| |
244 | 2871 |
|
3062 | 2872 |
aCursor isNil ifTrue:[^ self]. |
2873 |
||
244 | 2874 |
c := aCursor. |
3288
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2875 |
myDevice := self graphicsDevice. |
244 | 2876 |
self allViewsDo:[:aView | |
3288
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2877 |
|cId vId dev| |
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2878 |
|
3280 | 2879 |
dev := aView graphicsDevice. |
4408
308c798612a8
more care for brokenConnections.
Claus Gittinger <cg@exept.de>
parents:
4378
diff
changeset
|
2880 |
(dev notNil and:[dev isOpen]) ifTrue:[ |
3280 | 2881 |
c := c onDevice:dev. |
2882 |
(cId := c id) notNil ifTrue:[ |
|
2883 |
(vId := aView id) notNil ifTrue:[ |
|
2884 |
dev setCursor:cId in:vId. |
|
3288
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2885 |
dev ~~ myDevice ifTrue:[ |
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2886 |
dev flush |
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2887 |
] |
3280 | 2888 |
] |
3288
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2889 |
]. |
3286
21f022859294
flush device-queue when showing cursor,
Claus Gittinger <cg@exept.de>
parents:
3281
diff
changeset
|
2890 |
]. |
244 | 2891 |
]. |
3288
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2892 |
myDevice flush |
244 | 2893 |
! |
2894 |
||
2895 |
withCursor:aCursor do:aBlock |
|
2896 |
"evaluate aBlock while showing aCursor in all |
|
2897 |
my views (used to show wait-cursor while doing something). |
|
2898 |
Return the result as returned by aBlock." |
|
2899 |
||
6832 | 2900 |
|oldCursors dev deviceCursor retVal| |
317
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
2901 |
|
926
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
2902 |
dev := self graphicsDevice. |
7089 | 2903 |
(dev isNil or:[aCursor isNil or:[inWithCursorDoBlock == true]]) ifTrue:[ |
5266
e0a7f249435e
remember when already in a withCursorDo-block,
Claus Gittinger <cg@exept.de>
parents:
5260
diff
changeset
|
2904 |
^ aBlock value |
e0a7f249435e
remember when already in a withCursorDo-block,
Claus Gittinger <cg@exept.de>
parents:
5260
diff
changeset
|
2905 |
]. |
e0a7f249435e
remember when already in a withCursorDo-block,
Claus Gittinger <cg@exept.de>
parents:
5260
diff
changeset
|
2906 |
|
1652 | 2907 |
deviceCursor := aCursor onDevice:dev. |
2908 |
||
244 | 2909 |
" |
2910 |
get mapping of view->cursor for all of my subviews |
|
2911 |
" |
|
2912 |
oldCursors := IdentityDictionary new. |
|
6773 | 2913 |
[ |
2914 |
inWithCursorDoBlock := true. |
|
2915 |
||
2916 |
self allViewsDo:[:eachView | |
|
2917 |
|old| |
|
2918 |
||
2919 |
old := eachView cursor. |
|
2920 |
old ~~ deviceCursor ifTrue:[ |
|
2921 |
oldCursors at:eachView put:old. |
|
2922 |
eachView cursor:deviceCursor now:false |
|
2923 |
] |
|
2924 |
]. |
|
2925 |
||
6832 | 2926 |
retVal := aBlock value. |
6773 | 2927 |
|
6343 | 2928 |
"used to do a sync here to make the cursor visible, |
2929 |
but everything is so fast nowaday, that it doesn't make a difference" |
|
2930 |
dev flush. |
|
6773 | 2931 |
] ensure:[ |
2932 |
" |
|
2933 |
restore cursors from the mapping |
|
2934 |
" |
|
2935 |
oldCursors keysAndValuesDo:[:eachView :eachCursor | |
|
2936 |
eachView cursor:eachCursor now:false. |
|
2937 |
]. |
|
2938 |
dev flush. |
|
2939 |
inWithCursorDoBlock := false. |
|
1387
3fabdef0790d
better behavior if called recursively
Claus Gittinger <cg@exept.de>
parents:
1364
diff
changeset
|
2940 |
]. |
6832 | 2941 |
^ retVal |
1387
3fabdef0790d
better behavior if called recursively
Claus Gittinger <cg@exept.de>
parents:
1364
diff
changeset
|
2942 |
|
2097
d290e7910bec
dont change cursors of mainGroup
Claus Gittinger <cg@exept.de>
parents:
2093
diff
changeset
|
2943 |
"Modified: / 22.4.1998 / 14:36:47 / cg" |
408 | 2944 |
! |
2945 |
||
2213
84035dc560e0
added #withExecuteCursorDo: (for completeness)
Claus Gittinger <cg@exept.de>
parents:
2172
diff
changeset
|
2946 |
withExecuteCursorDo:aBlock |
84035dc560e0
added #withExecuteCursorDo: (for completeness)
Claus Gittinger <cg@exept.de>
parents:
2172
diff
changeset
|
2947 |
"evaluate aBlock while showing a busyCursor in all |
84035dc560e0
added #withExecuteCursorDo: (for completeness)
Claus Gittinger <cg@exept.de>
parents:
2172
diff
changeset
|
2948 |
my views (used to show busy-cursor while doing something time consuming). |
84035dc560e0
added #withExecuteCursorDo: (for completeness)
Claus Gittinger <cg@exept.de>
parents:
2172
diff
changeset
|
2949 |
Return the result as returned by aBlock." |
84035dc560e0
added #withExecuteCursorDo: (for completeness)
Claus Gittinger <cg@exept.de>
parents:
2172
diff
changeset
|
2950 |
|
84035dc560e0
added #withExecuteCursorDo: (for completeness)
Claus Gittinger <cg@exept.de>
parents:
2172
diff
changeset
|
2951 |
^ self withCursor:(Cursor execute) do:aBlock |
84035dc560e0
added #withExecuteCursorDo: (for completeness)
Claus Gittinger <cg@exept.de>
parents:
2172
diff
changeset
|
2952 |
|
84035dc560e0
added #withExecuteCursorDo: (for completeness)
Claus Gittinger <cg@exept.de>
parents:
2172
diff
changeset
|
2953 |
"Created: / 31.7.1998 / 20:11:52 / cg" |
84035dc560e0
added #withExecuteCursorDo: (for completeness)
Claus Gittinger <cg@exept.de>
parents:
2172
diff
changeset
|
2954 |
! |
84035dc560e0
added #withExecuteCursorDo: (for completeness)
Claus Gittinger <cg@exept.de>
parents:
2172
diff
changeset
|
2955 |
|
5922 | 2956 |
withReadCursorDo:aBlock |
2957 |
"evaluate aBlock while showing a readCursor in all |
|
2958 |
my views (used to show read-cursor while reading a file). |
|
2959 |
Return the result as returned by aBlock." |
|
2960 |
||
2961 |
^ self withCursor:(Cursor read) do:aBlock |
|
2962 |
||
2963 |
"Created: / 27-07-2012 / 09:43:47 / cg" |
|
2964 |
! |
|
2965 |
||
408 | 2966 |
withWaitCursorDo:aBlock |
2967 |
"evaluate aBlock while showing a waitCursor in all |
|
2968 |
my views (used to show wait-cursor while doing something time consuming). |
|
2969 |
Return the result as returned by aBlock." |
|
2970 |
||
2971 |
^ self withCursor:(Cursor wait) do:aBlock |
|
2972 |
||
2973 |
"Created: 6.2.1996 / 19:51:53 / cg" |
|
5922 | 2974 |
! |
2975 |
||
2976 |
withWriteCursorDo:aBlock |
|
2977 |
"evaluate aBlock while showing a writeCursor in all |
|
2978 |
my views (used to show read-cursor while writing a file). |
|
2979 |
Return the result as returned by aBlock." |
|
2980 |
||
2981 |
^ self withCursor:(Cursor write) do:aBlock |
|
2982 |
||
2983 |
"Created: / 27-07-2012 / 09:44:00 / cg" |
|
244 | 2984 |
! ! |
2985 |
||
7619 | 2986 |
!WindowGroup::WindowGroupQuery class methodsFor:'redefined answering'! |
2987 |
||
2988 |
answer:something do:action |
|
7827 | 2989 |
^ [ |
7619 | 2990 |
WindowGroup flushCachedActiveGroup. |
7827 | 2991 |
super answer:something do:action |
7619 | 2992 |
] ensure:[ |
2993 |
WindowGroup flushCachedActiveGroup |
|
2994 |
]. |
|
7827 | 2995 |
|
2996 |
"Modified: / 31-01-2017 / 20:28:14 / stefan" |
|
7619 | 2997 |
! ! |
2998 |
||
1110 | 2999 |
!WindowGroup class methodsFor:'documentation'! |
251 | 3000 |
|
3001 |
version |
|
7089 | 3002 |
^ '$Header$' |
5364
6f4ceb2bc439
behavior of escape key, while a chain of popup-menus is open
Claus Gittinger <cg@exept.de>
parents:
5350
diff
changeset
|
3003 |
! |
6f4ceb2bc439
behavior of escape key, while a chain of popup-menus is open
Claus Gittinger <cg@exept.de>
parents:
5350
diff
changeset
|
3004 |
|
6f4ceb2bc439
behavior of escape key, while a chain of popup-menus is open
Claus Gittinger <cg@exept.de>
parents:
5350
diff
changeset
|
3005 |
version_CVS |
7089 | 3006 |
^ '$Header$' |
251 | 3007 |
! ! |
3736 | 3008 |
|
6023 | 3009 |
|
244 | 3010 |
WindowGroup initialize! |