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