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