author | Claus Gittinger <cg@exept.de> |
Fri, 27 Feb 1998 15:22:26 +0100 | |
changeset 2072 | a9770eb53908 |
parent 2058 | 59a52789086a |
child 2085 | 908c3baa4a56 |
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 |
" |
|
0 | 12 |
|
13 |
Object subclass:#WindowSensor |
|
326 | 14 |
instanceVariableNames:'eventSemaphore damage mouseAndKeyboard compressMotionEvents |
260 | 15 |
ignoreUserInput exposeEventSemaphore catchExpose gotExpose |
16 |
gotOtherEvent translateKeyboardEvents shiftDown ctrlDown metaDown |
|
17 |
altDown leftButtonDown middleButtonDown rightButtonDown |
|
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
18 |
eventListener keyboardListener ignoreExposeEvents accessLock' |
326 | 19 |
classVariableNames:'ControlCEnabled EventListener ComposeTable GotCompose Compose1' |
20 |
poolDictionaries:'' |
|
21 |
category:'Interface-Support' |
|
0 | 22 |
! |
23 |
||
1082 | 24 |
!WindowSensor class methodsFor:'documentation'! |
46 | 25 |
|
26 |
copyright |
|
27 |
" |
|
28 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
72 | 29 |
All Rights Reserved |
46 | 30 |
|
31 |
This software is furnished under a license and may be used |
|
32 |
only in accordance with the terms of that license and with the |
|
33 |
inclusion of the above copyright notice. This software may not |
|
34 |
be provided or otherwise made available to, or used by, any |
|
35 |
other person. No title to or ownership of the software is |
|
36 |
hereby transferred. |
|
37 |
" |
|
38 |
! |
|
39 |
||
40 |
documentation |
|
41 |
" |
|
72 | 42 |
Instances of this class keep track of events and damage areas for a group of |
43 |
views. All incoming expose rectangles and events (from Workstation) are |
|
144 | 44 |
collected here, until someone (usually the windowGroup process) |
45 |
gets a chance to handle them. |
|
46 |
In contrast to ST-80 (which has one windowSensor per window), ST/X usually |
|
47 |
only assigns one sensor per windowGroup. |
|
157 | 48 |
(however, you could manually arrange for per view private sensors |
49 |
- at least, theoretically) |
|
144 | 50 |
|
72 | 51 |
When adding an expose rectangle, WindowSensor tries to merge the rectangle |
52 |
with the list of existing damages to minimize redrawing. |
|
47 | 53 |
|
158 | 54 |
Processing of compose key sequences is done here; if a Compose |
55 |
key event arrives, the following 2 characters are used to search an |
|
56 |
entry in the composeTable, and are replaced by the character found there. |
|
57 |
For example, pressing Compose-a-` gives the french a-accent-grave character; |
|
58 |
pressing Compose-a-e gives the ae ligature. |
|
59 |
||
144 | 60 |
Beside the above, windowSensors provide facilities (hooks) to allow |
157 | 61 |
a so-called 'eventListener' to get the event before it is entered into |
144 | 62 |
the queue. There are 3 possible listening hooks available: |
63 |
||
1271 | 64 |
a global EventListener - gets keybd/mouse events for all views |
65 |
a per-sensor eventListener - gets only keybd/mouse events for this sensors wGroup |
|
66 |
a per-sensor keyboardListener - only gets keyboard events for this sensors wGroup |
|
144 | 67 |
|
172 | 68 |
(actually, there are two more mechanisms, event delegation which allows |
69 |
delegation of key- and buttonEvents of a specific view, |
|
70 |
and per-windowGroup eventHooks) |
|
144 | 71 |
|
72 |
The global eventListener is installed via a class method (eventListener:) to |
|
73 |
the WindowSensor class; local listeners are installed via instance methods. |
|
74 |
Each listener should return true, if it handled the event and that event should |
|
75 |
therefore NOT be enqueued. Likewise, if it returns false, the event is |
|
157 | 76 |
processed as usual (i.e. enqueued and forwarded to the views controller). |
77 |
||
144 | 78 |
The global listener is called before the local listener, which is called |
79 |
before the keyboard listener. If any returns true, later listeners wont get |
|
80 |
the event. |
|
81 |
EventListeners were added to allow the implementation of event recorders |
|
157 | 82 |
or other spy functionality. They also allow hooking up views which otherwise |
83 |
insist on doing things themself. |
|
144 | 84 |
|
85 |
Notice, that beside event listening, you can also define a delegate for |
|
86 |
a views keyboard and button events. |
|
87 |
Read the documentation in WindowEvent for more info. |
|
88 |
||
89 |
||
598 | 90 |
[instance variables:] |
1271 | 91 |
eventSemaphore <Semaphore> the semaphore to be signalled when an event |
92 |
(or damage) arrives |
|
47 | 93 |
|
1271 | 94 |
damage <Collection> collection of damage events |
47 | 95 |
|
1271 | 96 |
mouseAndKeyboard <Collection> collection of user events |
47 | 97 |
|
1271 | 98 |
compressMotionEvents <Boolean> if true, multiple motion events are |
99 |
compressed to one event. If false, each |
|
100 |
event is handled individual. |
|
101 |
(should be set to false when doing free-hand drawing) |
|
47 | 102 |
|
1271 | 103 |
ignoreUserInput <Boolean> if true, key & button events are ignored |
104 |
(usually set to true by WindowGroup, while a |
|
105 |
modalbox covers a view) |
|
47 | 106 |
|
1271 | 107 |
shiftDown <Boolean> true while shift/meta/control-key is pressed |
108 |
metaDown (to support ST-80 style query: sensor shiftDown) |
|
109 |
ctrlDown |
|
110 |
altDown (notice, that on most systems, alt and meta key is |
|
111 |
the same, both reported as #Alt) |
|
72 | 112 |
|
1271 | 113 |
exposeEventSemaphore <Semaphore> X-special: semaphore to be signalled when |
114 |
expose event arrives after a copyArea. |
|
47 | 115 |
|
1295
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
116 |
catchExpose <SetOfView> if nonEMpty, the drawables which wait for |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
117 |
an expose/noExpose event. (after a copyArea) |
47 | 118 |
|
1295
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
119 |
gotExpose <SetOfView> the set of drawables which got an expose/noExpose |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
120 |
event. (after a copyarea) |
47 | 121 |
|
1295
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
122 |
gotOtherEvent <SetOfView> set of drawables which received if other events, |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
123 |
while waiting for expose (after a copyarea). |
47 | 124 |
|
1271 | 125 |
translateKeyboardEvents <Boolean> if true, keyboard events are translated via |
126 |
the devices leyboardMap; if false, they |
|
127 |
are reported as raw-keys. Default is true. |
|
81 | 128 |
|
1271 | 129 |
eventListener <Object> if non nil, this one will get all pointer |
130 |
and keyboard events for this sensors views first. |
|
131 |
If it returns true, the event is supposed to |
|
132 |
be already handled by the listener and not sent to |
|
133 |
the view. If false, the event is handled as usual. |
|
134 |
This allows applications to catch events for any of |
|
135 |
its views. |
|
140 | 136 |
|
1271 | 137 |
keyboardListener <Object> if non nil, this one will get all keyboard events |
138 |
for this sensors views first (but after the eventListener, |
|
139 |
if any). |
|
140 |
If it returns true, the event is supposed to |
|
141 |
be already handled by the listener and not sent to |
|
142 |
the view. If false, the event is handled as usual. |
|
143 |
This allows applications to catch events for any of |
|
144 |
its views. |
|
145 |
ApplicationModels can catch keyboard input with: |
|
146 |
postOpenWith:aBuilder |
|
147 |
aBuilder window sensor keyboardListener:self |
|
140 | 148 |
|
1271 | 149 |
accessLock <Semaphore> controls access to the event queues |
140 | 150 |
|
598 | 151 |
[class variables:] |
140 | 152 |
|
1271 | 153 |
ControlCEnabled <Boolean> if true (which is the default) Control-C |
154 |
will interrupt the process handling the |
|
155 |
view. |
|
156 |
For secure stand-alone applications, |
|
157 |
this can be set to false, in which case |
|
158 |
Control-C does NOT interrupt the process. |
|
124 | 159 |
|
1271 | 160 |
EventListener <Object> if non nil, this one will get all pointer |
161 |
and keyboard events for ALL views first. |
|
162 |
If it returns true, the event is supposed to |
|
163 |
be already handled by the listener and not enqueued. |
|
164 |
If false, the event is handled as usual. |
|
165 |
This allows overall event catchers to be |
|
166 |
installed for example to implement event |
|
167 |
recorders, active help managers etc. |
|
157 | 168 |
|
1271 | 169 |
ComposeTable <Array> compose-key translation table |
598 | 170 |
|
171 |
||
612 | 172 |
[author:] |
1271 | 173 |
Claus Gittinger |
612 | 174 |
|
598 | 175 |
[see also:] |
1271 | 176 |
WindowGroup |
177 |
WindowEvent KeyboardMap KeyboardForwarder EventListener |
|
178 |
DeviceWorkstation View |
|
46 | 179 |
" |
180 |
! ! |
|
181 |
||
1082 | 182 |
!WindowSensor class methodsFor:'initialization'! |
47 | 183 |
|
184 |
initialize |
|
581 | 185 |
"initialize the classes constants" |
186 |
||
81 | 187 |
ControlCEnabled := true. |
158 | 188 |
|
386 | 189 |
ComposeTable isNil ifTrue:[ |
1271 | 190 |
self initializeComposeKeyTable |
386 | 191 |
] |
157 | 192 |
|
193 |
" |
|
194 |
WindowSensor initialize |
|
195 |
" |
|
581 | 196 |
|
197 |
"Modified: 22.4.1996 / 16:19:24 / cg" |
|
198 |
! |
|
199 |
||
200 |
initializeComposeKeyTable |
|
201 |
"setup the composeKey table" |
|
202 |
||
203 |
ComposeTable := #( |
|
1271 | 204 |
"/ format is: |
205 |
"/ ( key1 key2 <character or asciiValue> ) |
|
206 |
"/ |
|
207 |
($+ $+ $#) "/ number-sign |
|
208 |
($A $A $@) "/ at-sign |
|
581 | 209 |
|
1271 | 210 |
($( $- ${) "/ left brace |
211 |
($) $- $}) "/ right brace |
|
581 | 212 |
|
1271 | 213 |
($| $c 16rA2) "/ cent-sign |
214 |
($| $S $$) "/ dollar-sign |
|
215 |
($= $L 16rA3) "/ pound-sign |
|
216 |
($= $Y 16rA5) "/ yen-sign |
|
217 |
($!! $s 16rA7) "/ section-sign |
|
218 |
($O $C 16rA9) "/ copyright |
|
219 |
($< $< 16rAB) "/ french <<-quotes |
|
220 |
($O $R 16rAE) "/ registered |
|
221 |
($/ $u 16rB5) "/ greek mu |
|
222 |
($!! $p 16rB6) "/ paragraph sign |
|
223 |
($> $> 16rBB) "/ french >> quotes |
|
224 |
($^ $0 16rB0) "/ degree sign |
|
225 |
($+ $- 16rB1) "/ plus-minus |
|
226 |
($^ $2 16rB2) "/ superscript-2 |
|
227 |
($^ $3 16rB3) "/ superscript-3 |
|
228 |
($^ $. 16rB7) "/ middle dot |
|
229 |
($^ $1 16rB9) "/ superscript-1 |
|
230 |
($1 $4 16rBC) "/ 1/4 |
|
231 |
($1 $2 16rBD) "/ 1/2 |
|
232 |
($3 $4 16rBE) "/ 3/4 |
|
233 |
($? $? 16rBF) "/ ?-inverted |
|
234 |
($- $: 16rF7) "/ divide |
|
581 | 235 |
|
1271 | 236 |
"/ diacriticals: Compose diacrit character |
237 |
"/ grave |
|
581 | 238 |
|
1271 | 239 |
($A $` 16rC0) "/ A-` |
240 |
($a $` 16rE0) "/ a-` |
|
241 |
($E $` 16rC8) "/ E-` |
|
242 |
($e $` 16rE8) "/ e-` |
|
243 |
($I $` 16rCC) "/ I-` |
|
244 |
($i $` 16rEC) "/ i-` |
|
245 |
($O $` 16rD2) "/ O-` |
|
246 |
($o $` 16rF2) "/ o-` |
|
247 |
($U $` 16rD9) "/ U-` |
|
248 |
($u $` 16rF9) "/ u-` |
|
581 | 249 |
|
1271 | 250 |
"/ acute |
251 |
($A $' 16rC1) "/ A-' |
|
252 |
($a $' 16rE1) "/ a-' |
|
253 |
($E $' 16rC9) "/ E-' |
|
254 |
($e $' 16rE9) "/ e-' |
|
255 |
($I $' 16rCD) "/ I-' |
|
256 |
($i $' 16rED) "/ i-' |
|
257 |
($O $' 16rD3) "/ O-' |
|
258 |
($o $' 16rF3) "/ o-' |
|
259 |
($U $' 16rDA) "/ U-' |
|
260 |
($u $' 16rFA) "/ u-' |
|
261 |
($Y $' 16rDD) "/ Y-' |
|
262 |
($y $' 16rFD) "/ y-' |
|
581 | 263 |
|
1271 | 264 |
"/ circumflex |
265 |
($A $^ 16rC2) "/ A-^ |
|
266 |
($a $^ 16rE2) "/ a-^ |
|
267 |
($E $^ 16rCA) "/ E-^ |
|
268 |
($e $^ 16rEA) "/ e-^ |
|
269 |
($I $^ 16rCE) "/ I-^ |
|
270 |
($i $^ 16rEE) "/ i-^ |
|
271 |
($O $^ 16rD4) "/ O-^ |
|
272 |
($o $^ 16rF4) "/ o-^ |
|
273 |
($U $^ 16rDB) "/ U-^ |
|
274 |
($u $^ 16rFB) "/ u-^ |
|
581 | 275 |
|
1271 | 276 |
"/ tilde |
277 |
($A $~ 16rC3) "/ A-~ |
|
278 |
($a $~ 16rE3) "/ a-~ |
|
279 |
($O $~ 16rD5) "/ O-~ |
|
280 |
($o $~ 16rF5) "/ o-~ |
|
281 |
($N $~ 16rD1) "/ N-tilde |
|
282 |
($n $~ 16rF1) "/ n-~ |
|
581 | 283 |
|
1271 | 284 |
"/ ring above |
285 |
($a $* 16rE5) "/ a-* |
|
286 |
($A $* 16rC5) "/ A-* |
|
581 | 287 |
|
1271 | 288 |
"/ cedille |
289 |
($C $, 16rC7) "/ C-, |
|
290 |
($c $, 16rE7) "/ c-, |
|
581 | 291 |
|
1271 | 292 |
"/ dieresis |
293 |
($A $" 16rC4) "/ A-" |
|
294 |
($a $" 16rE4) "/ a-" |
|
295 |
($E $" 16rCB) "/ E-" |
|
296 |
($e $" 16rEB) "/ e-" |
|
297 |
($I $" 16rCF) "/ I-" |
|
298 |
($i $" 16rEF) "/ i-" |
|
299 |
($O $" 16rD6) "/ O-" |
|
300 |
($o $" 16rF6) "/ o-" |
|
301 |
($U $" 16rDC) "/ U-" |
|
302 |
($u $" 16rFC) "/ u-" |
|
303 |
($y $" 16rFF) "/ y-" |
|
581 | 304 |
|
1271 | 305 |
"/ slashed |
306 |
($o $/ 16rF8) "/ o-/ |
|
307 |
($O $/ 16rD8) "/ O-/ |
|
608 | 308 |
|
1271 | 309 |
"/ ligatures |
310 |
($s $s 16rDF) "/ german sz |
|
311 |
($a $e 16rE6) "/ (french) ae |
|
312 |
($A $E 16rC6) "/ (french) AE |
|
581 | 313 |
). |
314 |
||
608 | 315 |
" |
581 | 316 |
WindowSensor initializeComposeKeyTable |
317 |
" |
|
318 |
||
319 |
"Created: 22.4.1996 / 14:06:43 / cg" |
|
608 | 320 |
"Modified: 24.4.1996 / 16:37:08 / cg" |
140 | 321 |
! ! |
81 | 322 |
|
1082 | 323 |
!WindowSensor class methodsFor:'instance creation'! |
140 | 324 |
|
325 |
new |
|
581 | 326 |
"return a new initialized instance" |
327 |
||
140 | 328 |
^ self basicNew initialize |
581 | 329 |
|
330 |
"Modified: 22.4.1996 / 16:19:40 / cg" |
|
124 | 331 |
! ! |
332 |
||
1082 | 333 |
!WindowSensor class methodsFor:'accessing'! |
47 | 334 |
|
244 | 335 |
composeTable |
336 |
"return the compose-key table. |
|
337 |
Entries consist of 3-element arrays each, where |
|
338 |
the first two entries (of each entry) are the raw characters, |
|
339 |
and the third is the resulting composed-key" |
|
340 |
||
341 |
^ ComposeTable |
|
342 |
! |
|
343 |
||
344 |
composeTable:aTable |
|
345 |
"set the compose-key table. |
|
346 |
Entries consist of 3-element arrays each, where |
|
347 |
the first two entries (of each entry) are the raw characters, |
|
348 |
and the third is the resulting composed-key" |
|
349 |
||
350 |
ComposeTable := aTable |
|
351 |
! |
|
352 |
||
144 | 353 |
controlCEnabled:aBoolean |
354 |
"enable/disable Control-C processing. |
|
355 |
If enabled, pressing CNTL-C in a view will interrupt it and bring |
|
1940 | 356 |
its process into the debugger (actually raising a UserInterrupt signal). |
47 | 357 |
Otherwise, CNTL-C is sent to the view like any other key. |
144 | 358 |
The default is true (enabled). |
1940 | 359 |
Be very careful - only disable CNTL-C handling for well-debugged |
360 |
applications ... however, even if disabled, there still is the CNTL-C |
|
361 |
key on the startup (x)-terminal window (which can also be disabled). |
|
47 | 362 |
" |
363 |
||
144 | 364 |
ControlCEnabled := aBoolean |
1940 | 365 |
|
366 |
"Modified: / 29.10.1997 / 15:48:29 / cg" |
|
124 | 367 |
! |
368 |
||
369 |
eventListener |
|
370 |
"return the eventListener |
|
371 |
- see documentation for what this can be used for" |
|
372 |
||
373 |
^ EventListener |
|
157 | 374 |
! |
375 |
||
244 | 376 |
eventListener:aListener |
377 |
"set the eventListener |
|
378 |
- see documentation for what this can be used for" |
|
157 | 379 |
|
244 | 380 |
EventListener := aListener |
47 | 381 |
! ! |
382 |
||
1082 | 383 |
!WindowSensor class methodsFor:'queries'! |
133 | 384 |
|
385 |
cursorPoint |
|
140 | 386 |
"ST-80 compatibility: |
157 | 387 |
return the position of the cursor on the current display" |
133 | 388 |
|
153 | 389 |
^ Screen current pointerPosition |
133 | 390 |
|
391 |
" |
|
392 |
WindowSensor cursorPoint |
|
393 |
" |
|
394 |
! ! |
|
395 |
||
1412
c2553d477315
handle #quit event (ST-80 support)
Claus Gittinger <cg@exept.de>
parents:
1359
diff
changeset
|
396 |
!WindowSensor methodsFor:'ST-80 compatibility'! |
c2553d477315
handle #quit event (ST-80 support)
Claus Gittinger <cg@exept.de>
parents:
1359
diff
changeset
|
397 |
|
c2553d477315
handle #quit event (ST-80 support)
Claus Gittinger <cg@exept.de>
parents:
1359
diff
changeset
|
398 |
eventQuit:event |
c2553d477315
handle #quit event (ST-80 support)
Claus Gittinger <cg@exept.de>
parents:
1359
diff
changeset
|
399 |
"ST-80 compatibility: |
c2553d477315
handle #quit event (ST-80 support)
Claus Gittinger <cg@exept.de>
parents:
1359
diff
changeset
|
400 |
push an event for terminating the topViews application" |
c2553d477315
handle #quit event (ST-80 support)
Claus Gittinger <cg@exept.de>
parents:
1359
diff
changeset
|
401 |
|
c2553d477315
handle #quit event (ST-80 support)
Claus Gittinger <cg@exept.de>
parents:
1359
diff
changeset
|
402 |
^ self pushEvent:(WindowEvent |
c2553d477315
handle #quit event (ST-80 support)
Claus Gittinger <cg@exept.de>
parents:
1359
diff
changeset
|
403 |
for:nil |
c2553d477315
handle #quit event (ST-80 support)
Claus Gittinger <cg@exept.de>
parents:
1359
diff
changeset
|
404 |
type:#quit) |
c2553d477315
handle #quit event (ST-80 support)
Claus Gittinger <cg@exept.de>
parents:
1359
diff
changeset
|
405 |
|
c2553d477315
handle #quit event (ST-80 support)
Claus Gittinger <cg@exept.de>
parents:
1359
diff
changeset
|
406 |
"Modified: 3.3.1997 / 20:15:00 / cg" |
c2553d477315
handle #quit event (ST-80 support)
Claus Gittinger <cg@exept.de>
parents:
1359
diff
changeset
|
407 |
! ! |
c2553d477315
handle #quit event (ST-80 support)
Claus Gittinger <cg@exept.de>
parents:
1359
diff
changeset
|
408 |
|
244 | 409 |
!WindowSensor methodsFor:'accessing'! |
410 |
||
411 |
compressMotionEvents:aBoolean |
|
412 |
"turn on/off motion event compression" |
|
413 |
||
414 |
compressMotionEvents := aBoolean |
|
415 |
! |
|
416 |
||
1847
f449f3009e88
need even more protection against process-interrupts
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
417 |
criticalEventQueueAccess:aBlock |
f449f3009e88
need even more protection against process-interrupts
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
418 |
|wasBlocked| |
f449f3009e88
need even more protection against process-interrupts
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
419 |
|
f449f3009e88
need even more protection against process-interrupts
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
420 |
wasBlocked := Processor activeProcess blockInterrupts. |
f449f3009e88
need even more protection against process-interrupts
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
421 |
[ |
f449f3009e88
need even more protection against process-interrupts
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
422 |
accessLock critical:aBlock |
f449f3009e88
need even more protection against process-interrupts
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
423 |
] valueNowOrOnUnwindDo:[ |
f449f3009e88
need even more protection against process-interrupts
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
424 |
wasBlocked ifFalse:[ |
f449f3009e88
need even more protection against process-interrupts
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
425 |
Processor activeProcess unblockInterrupts. |
f449f3009e88
need even more protection against process-interrupts
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
426 |
] |
f449f3009e88
need even more protection against process-interrupts
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
427 |
] |
f449f3009e88
need even more protection against process-interrupts
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
428 |
! |
f449f3009e88
need even more protection against process-interrupts
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
429 |
|
244 | 430 |
eventListener |
431 |
"return the eventListener |
|
432 |
- see documentation for what this can be used for" |
|
433 |
||
434 |
^ eventListener |
|
435 |
! |
|
436 |
||
437 |
eventListener:aListener |
|
438 |
"set the eventListener |
|
439 |
- see documentation for what this can be used for" |
|
440 |
||
441 |
eventListener := aListener |
|
442 |
||
443 |
! |
|
140 | 444 |
|
244 | 445 |
eventSemaphore |
446 |
"return the semaphore used to signal event arrival" |
|
447 |
||
448 |
^ eventSemaphore |
|
449 |
! |
|
450 |
||
451 |
eventSemaphore:aSemaphore |
|
452 |
"set the semaphore used to signal event arrival" |
|
453 |
||
454 |
eventSemaphore := aSemaphore |
|
455 |
! |
|
456 |
||
703
4324ab5e3630
added facility to lock expose event queue (temporary kludge ?)
Claus Gittinger <cg@exept.de>
parents:
612
diff
changeset
|
457 |
ignoreExposeEvents:aBoolean |
4324ab5e3630
added facility to lock expose event queue (temporary kludge ?)
Claus Gittinger <cg@exept.de>
parents:
612
diff
changeset
|
458 |
ignoreExposeEvents := aBoolean |
4324ab5e3630
added facility to lock expose event queue (temporary kludge ?)
Claus Gittinger <cg@exept.de>
parents:
612
diff
changeset
|
459 |
|
4324ab5e3630
added facility to lock expose event queue (temporary kludge ?)
Claus Gittinger <cg@exept.de>
parents:
612
diff
changeset
|
460 |
"Created: 21.5.1996 / 18:21:18 / cg" |
4324ab5e3630
added facility to lock expose event queue (temporary kludge ?)
Claus Gittinger <cg@exept.de>
parents:
612
diff
changeset
|
461 |
! |
4324ab5e3630
added facility to lock expose event queue (temporary kludge ?)
Claus Gittinger <cg@exept.de>
parents:
612
diff
changeset
|
462 |
|
244 | 463 |
ignoreUserInput |
464 |
"return true, if Ctrl-C processing is currently turned off" |
|
465 |
||
466 |
^ ignoreUserInput |
|
467 |
! |
|
468 |
||
469 |
ignoreUserInput:aBoolean |
|
470 |
"turn on/off ignoring of Ctrl-C processing" |
|
471 |
||
472 |
ignoreUserInput := aBoolean |
|
140 | 473 |
! |
474 |
||
244 | 475 |
keyboardListener |
476 |
"return the keyboardListener |
|
477 |
- see documentation for what this can be used for" |
|
478 |
||
479 |
^ keyboardListener |
|
480 |
! |
|
481 |
||
482 |
keyboardListener:aListener |
|
483 |
"set the keyboardListener |
|
484 |
- see documentation for what this can be used for" |
|
485 |
||
486 |
keyboardListener := aListener |
|
487 |
||
488 |
! ! |
|
489 |
||
490 |
!WindowSensor methodsFor:'event flushing'! |
|
144 | 491 |
|
244 | 492 |
compressKeyPressEventsWithKey:aKey |
493 |
"count and remove multiple pending keyPress events for the |
|
494 |
same key, aKey. This is currently used in TextViews to compress |
|
495 |
multiple cursorUp/cursorDown events and do the scroll in one |
|
496 |
operation. (to avoid run-after-cursor on slow displays)" |
|
497 |
||
2022 | 498 |
|n ev evKey| |
244 | 499 |
|
500 |
n := 0. |
|
501 |
ev := self pendingEvent. |
|
2022 | 502 |
|
503 |
[ev notNil and:[ev isKeyEvent]] whileTrue:[ |
|
504 |
evKey := ev arguments at:1. |
|
505 |
(evKey == aKey) ifTrue:[ |
|
506 |
ev isKeyReleaseEvent ifTrue:[ |
|
507 |
self nextEvent. |
|
508 |
ev := self pendingEvent. |
|
509 |
] ifFalse:[ |
|
510 |
n := n + 1. |
|
511 |
self nextEvent. |
|
512 |
ev := self pendingEvent. |
|
513 |
] |
|
514 |
] ifFalse:[ |
|
515 |
ev := nil |
|
516 |
] |
|
144 | 517 |
]. |
244 | 518 |
^ n |
2022 | 519 |
|
520 |
"Modified: / 27.1.1998 / 14:15:00 / cg" |
|
244 | 521 |
! |
522 |
||
523 |
flushEventsFor:aView |
|
524 |
"throw away all events for aView, |
|
525 |
or any view, if the argument is nil." |
|
526 |
||
527 |
self flushExposeEventsFor:aView. |
|
528 |
self flushUserEventsFor:aView. |
|
529 |
! |
|
530 |
||
1790
a7f42261ab45
need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents:
1734
diff
changeset
|
531 |
flushEventsFor:aView inQueue:anEventQueue and:aCondition |
a7f42261ab45
need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents:
1734
diff
changeset
|
532 |
"throw away all pending damage events for aView, |
a7f42261ab45
need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents:
1734
diff
changeset
|
533 |
for which aCondition returns true. |
a7f42261ab45
need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents:
1734
diff
changeset
|
534 |
Or any view for which aCondition returns true, if the argument is nil. |
a7f42261ab45
need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents:
1734
diff
changeset
|
535 |
A helper for the various flush entries." |
a7f42261ab45
need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents:
1734
diff
changeset
|
536 |
|
1847
f449f3009e88
need even more protection against process-interrupts
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
537 |
self criticalEventQueueAccess:[ |
f449f3009e88
need even more protection against process-interrupts
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
538 |
|nEvent "{ Class: SmallInteger }" anEvent| |
f449f3009e88
need even more protection against process-interrupts
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
539 |
|
f449f3009e88
need even more protection against process-interrupts
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
540 |
damage notNil ifTrue:[ |
f449f3009e88
need even more protection against process-interrupts
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
541 |
nEvent := anEventQueue size. |
f449f3009e88
need even more protection against process-interrupts
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
542 |
1 to:nEvent do:[:index | |
f449f3009e88
need even more protection against process-interrupts
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
543 |
anEvent := anEventQueue at:index. |
f449f3009e88
need even more protection against process-interrupts
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
544 |
anEvent notNil ifTrue:[ |
f449f3009e88
need even more protection against process-interrupts
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
545 |
(aView isNil or:[anEvent view == aView]) ifTrue:[ |
f449f3009e88
need even more protection against process-interrupts
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
546 |
(aCondition value:anEvent) ifTrue:[ |
f449f3009e88
need even more protection against process-interrupts
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
547 |
anEventQueue at:index put:nil |
1790
a7f42261ab45
need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents:
1734
diff
changeset
|
548 |
] |
a7f42261ab45
need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents:
1734
diff
changeset
|
549 |
] |
a7f42261ab45
need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents:
1734
diff
changeset
|
550 |
] |
1847
f449f3009e88
need even more protection against process-interrupts
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
551 |
] |
1790
a7f42261ab45
need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents:
1734
diff
changeset
|
552 |
]. |
a7f42261ab45
need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents:
1734
diff
changeset
|
553 |
] |
a7f42261ab45
need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents:
1734
diff
changeset
|
554 |
|
a7f42261ab45
need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents:
1734
diff
changeset
|
555 |
"Created: 28.6.1997 / 16:11:35 / cg" |
1851
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
556 |
"Modified: 6.8.1997 / 20:31:34 / cg" |
1790
a7f42261ab45
need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents:
1734
diff
changeset
|
557 |
! |
a7f42261ab45
need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents:
1734
diff
changeset
|
558 |
|
244 | 559 |
flushExposeEvents |
560 |
"throw away all pending expose events; this |
|
561 |
can be done after a full redraw (or in views, which are |
|
562 |
doing full redraws anly)" |
|
563 |
||
1790
a7f42261ab45
need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents:
1734
diff
changeset
|
564 |
self |
a7f42261ab45
need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents:
1734
diff
changeset
|
565 |
flushEventsFor:nil inQueue:damage and:[:event | event isDamage]. |
a7f42261ab45
need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents:
1734
diff
changeset
|
566 |
|
1851
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
567 |
"Modified: 6.8.1997 / 20:31:45 / cg" |
144 | 568 |
! |
569 |
||
244 | 570 |
flushExposeEventsFor:aView |
571 |
"throw away all pending expose events for aView, |
|
572 |
or any view, if the argument is nil. |
|
573 |
This can be done after a full redraw |
|
574 |
(or in views, which are always doing full redraws - |
|
575 |
instead of drawing the clip-area only)" |
|
576 |
||
1790
a7f42261ab45
need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents:
1734
diff
changeset
|
577 |
self |
a7f42261ab45
need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents:
1734
diff
changeset
|
578 |
flushEventsFor:aView inQueue:damage and:[:event | event isDamage]. |
a7f42261ab45
need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents:
1734
diff
changeset
|
579 |
|
1851
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
580 |
"Modified: 6.8.1997 / 20:31:54 / cg" |
244 | 581 |
! |
582 |
||
583 |
flushKeyboard |
|
584 |
"ST-80 compatibility: throw away all pending keyboard events" |
|
585 |
||
586 |
self flushKeyboardFor:nil |
|
587 |
! |
|
588 |
||
589 |
flushKeyboardFor:aView |
|
590 |
"throw away all pending keyboard events for aView, |
|
591 |
or any view, if the argument is nil." |
|
592 |
||
1790
a7f42261ab45
need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents:
1734
diff
changeset
|
593 |
self |
a7f42261ab45
need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents:
1734
diff
changeset
|
594 |
flushEventsFor:aView inQueue:mouseAndKeyboard |
a7f42261ab45
need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents:
1734
diff
changeset
|
595 |
and:[:event | event isKeyEvent] |
a7f42261ab45
need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents:
1734
diff
changeset
|
596 |
|
1851
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
597 |
"Modified: 6.8.1997 / 20:32:05 / cg" |
244 | 598 |
! |
599 |
||
1731 | 600 |
flushMotionEventsFor:aView |
601 |
"throw away all pending motion events for aView, |
|
602 |
or for any view, if the argument is nil." |
|
603 |
||
1790
a7f42261ab45
need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents:
1734
diff
changeset
|
604 |
self |
a7f42261ab45
need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents:
1734
diff
changeset
|
605 |
flushEventsFor:aView inQueue:mouseAndKeyboard |
a7f42261ab45
need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents:
1734
diff
changeset
|
606 |
and:[:event | event isButtonMotionEvent] |
a7f42261ab45
need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents:
1734
diff
changeset
|
607 |
|
1851
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
608 |
"Modified: 6.8.1997 / 20:32:10 / cg" |
1731 | 609 |
! |
610 |
||
244 | 611 |
flushUserEvents |
612 |
"throw away all pending user events" |
|
613 |
||
614 |
(mouseAndKeyboard isNil or:[mouseAndKeyboard size > 0]) ifTrue:[ |
|
1271 | 615 |
self flushUserEventsFor:nil |
244 | 616 |
]. |
1159
e5247f8a48f3
do not flush synthetic events in #flushUserEvents
Claus Gittinger <cg@exept.de>
parents:
1155
diff
changeset
|
617 |
|
e5247f8a48f3
do not flush synthetic events in #flushUserEvents
Claus Gittinger <cg@exept.de>
parents:
1155
diff
changeset
|
618 |
"Modified: 8.1.1997 / 11:23:11 / cg" |
244 | 619 |
! |
620 |
||
621 |
flushUserEventsFor:aView |
|
622 |
"throw away all pending user events for aView, |
|
1159
e5247f8a48f3
do not flush synthetic events in #flushUserEvents
Claus Gittinger <cg@exept.de>
parents:
1155
diff
changeset
|
623 |
or for any view, if the argument is nil." |
244 | 624 |
|
1790
a7f42261ab45
need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents:
1734
diff
changeset
|
625 |
self |
a7f42261ab45
need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents:
1734
diff
changeset
|
626 |
flushEventsFor:aView inQueue:mouseAndKeyboard |
a7f42261ab45
need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents:
1734
diff
changeset
|
627 |
and:[:event | event isUserEvent] |
a7f42261ab45
need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents:
1734
diff
changeset
|
628 |
|
1851
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
629 |
"Modified: 6.8.1997 / 20:32:14 / cg" |
157 | 630 |
! ! |
631 |
||
632 |
!WindowSensor methodsFor:'event processing'! |
|
633 |
||
140 | 634 |
buttonMotion:state x:x y:y view:aView |
635 |
"mouse was moved - this is sent from the device (Display)" |
|
636 |
||
1861
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
637 |
|args ev| |
140 | 638 |
|
1100 | 639 |
"/ update my idea of shift/alt/ctrl pressed information |
640 |
self updateModifierStateFrom:state device:(aView graphicsDevice). |
|
641 |
||
140 | 642 |
EventListener notNil ifTrue:[ |
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
643 |
(EventListener buttonMotion:state x:x y:y view:aView) ifTrue:[^ self] |
140 | 644 |
]. |
645 |
eventListener notNil ifTrue:[ |
|
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
646 |
(eventListener buttonMotion:state x:x y:y view:aView) ifTrue:[^ self] |
140 | 647 |
]. |
648 |
||
649 |
ignoreUserInput == true ifTrue:[ |
|
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
650 |
^ self |
140 | 651 |
]. |
652 |
args := Array with:state with:x with:y. |
|
653 |
||
654 |
compressMotionEvents ifTrue:[ |
|
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
655 |
" |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
656 |
merge with last motion |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
657 |
" |
1847
f449f3009e88
need even more protection against process-interrupts
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
658 |
self criticalEventQueueAccess:[ |
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
659 |
mouseAndKeyboard reverseDo:[:ev | |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
660 |
ev notNil ifTrue:[ |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
661 |
((ev type == #buttonMotion:x:y:) |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
662 |
and:[(ev view == aView) |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
663 |
and:[(ev arguments at:1) == state]]) ifTrue:[ |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
664 |
ev arguments:args. |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
665 |
^ self |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
666 |
] |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
667 |
] |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
668 |
] |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
669 |
] |
140 | 670 |
]. |
1861
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
671 |
|
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
672 |
ev := WindowEvent buttonEvent |
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
673 |
for:aView |
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
674 |
type:#buttonMotion:x:y: |
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
675 |
arguments:args. |
1862
e56d9a7389bb
also remember buttonStates in keyEvents.
Claus Gittinger <cg@exept.de>
parents:
1861
diff
changeset
|
676 |
ev hasShift:shiftDown ctrl:ctrlDown alt:altDown meta:metaDown |
e56d9a7389bb
also remember buttonStates in keyEvents.
Claus Gittinger <cg@exept.de>
parents:
1861
diff
changeset
|
677 |
button1:leftButtonDown button2:middleButtonDown button3:rightButtonDown. |
1861
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
678 |
self pushEvent:ev. |
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
679 |
|
1862
e56d9a7389bb
also remember buttonStates in keyEvents.
Claus Gittinger <cg@exept.de>
parents:
1861
diff
changeset
|
680 |
"Modified: 13.8.1997 / 22:19:06 / cg" |
140 | 681 |
! |
682 |
||
244 | 683 |
buttonMultiPress:button x:x y:y view:aView |
684 |
"mouse button was pressed - this is sent from the device (Display)" |
|
140 | 685 |
|
1861
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
686 |
|ev| |
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
687 |
|
1083
6e947cc67324
fixed #anyButtonPressed & setting of buttonDown-flags
Claus Gittinger <cg@exept.de>
parents:
1082
diff
changeset
|
688 |
self button:button inView:aView state:true. |
6e947cc67324
fixed #anyButtonPressed & setting of buttonDown-flags
Claus Gittinger <cg@exept.de>
parents:
1082
diff
changeset
|
689 |
|
140 | 690 |
EventListener notNil ifTrue:[ |
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
691 |
(EventListener buttonMultiPress:button x:x y:y view:aView) ifTrue:[^ self] |
140 | 692 |
]. |
693 |
eventListener notNil ifTrue:[ |
|
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
694 |
(eventListener buttonMultiPress:button x:x y:y view:aView) ifTrue:[^ self] |
140 | 695 |
]. |
696 |
||
697 |
ignoreUserInput == true ifTrue:[ |
|
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
698 |
^ self |
140 | 699 |
]. |
1083
6e947cc67324
fixed #anyButtonPressed & setting of buttonDown-flags
Claus Gittinger <cg@exept.de>
parents:
1082
diff
changeset
|
700 |
|
1861
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
701 |
ev := WindowEvent buttonEvent |
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
702 |
for:aView |
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
703 |
type:#buttonMultiPress:x:y: |
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
704 |
arguments:(Array with:button with:x with:y). |
1862
e56d9a7389bb
also remember buttonStates in keyEvents.
Claus Gittinger <cg@exept.de>
parents:
1861
diff
changeset
|
705 |
ev hasShift:shiftDown ctrl:ctrlDown alt:altDown meta:metaDown |
e56d9a7389bb
also remember buttonStates in keyEvents.
Claus Gittinger <cg@exept.de>
parents:
1861
diff
changeset
|
706 |
button1:leftButtonDown button2:middleButtonDown button3:rightButtonDown. |
1861
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
707 |
self pushEvent:ev. |
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
708 |
|
1862
e56d9a7389bb
also remember buttonStates in keyEvents.
Claus Gittinger <cg@exept.de>
parents:
1861
diff
changeset
|
709 |
"Modified: 13.8.1997 / 22:19:11 / cg" |
140 | 710 |
! |
711 |
||
712 |
buttonPress:button x:x y:y view:aView |
|
713 |
"mouse button was pressed - this is sent from the device (Display)" |
|
714 |
||
1861
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
715 |
|ev| |
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
716 |
|
157 | 717 |
self button:button inView:aView state:true. |
718 |
||
140 | 719 |
EventListener notNil ifTrue:[ |
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
720 |
(EventListener buttonPress:button x:x y:y view:aView) ifTrue:[^ self] |
140 | 721 |
]. |
722 |
eventListener notNil ifTrue:[ |
|
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
723 |
(eventListener buttonPress:button x:x y:y view:aView) ifTrue:[^ self] |
140 | 724 |
]. |
725 |
||
726 |
ignoreUserInput == true ifTrue:[ |
|
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
727 |
^ self |
140 | 728 |
]. |
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
729 |
|
1861
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
730 |
ev := WindowEvent buttonEvent |
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
731 |
for:aView |
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
732 |
type:#buttonPress:x:y: |
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
733 |
arguments:(Array with:button with:x with:y). |
1862
e56d9a7389bb
also remember buttonStates in keyEvents.
Claus Gittinger <cg@exept.de>
parents:
1861
diff
changeset
|
734 |
ev hasShift:shiftDown ctrl:ctrlDown alt:altDown meta:metaDown |
e56d9a7389bb
also remember buttonStates in keyEvents.
Claus Gittinger <cg@exept.de>
parents:
1861
diff
changeset
|
735 |
button1:leftButtonDown button2:middleButtonDown button3:rightButtonDown. |
1861
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
736 |
self pushEvent:ev. |
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
737 |
|
1862
e56d9a7389bb
also remember buttonStates in keyEvents.
Claus Gittinger <cg@exept.de>
parents:
1861
diff
changeset
|
738 |
"Modified: 13.8.1997 / 22:19:13 / cg" |
140 | 739 |
! |
740 |
||
244 | 741 |
buttonRelease:button x:x y:y view:aView |
742 |
"mouse button was released- this is sent from the device (Display)" |
|
743 |
||
1861
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
744 |
|ev| |
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
745 |
|
244 | 746 |
self button:button inView:aView state:false. |
747 |
||
748 |
EventListener notNil ifTrue:[ |
|
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
749 |
(EventListener buttonRelease:button x:x y:y view:aView) ifTrue:[^ self] |
244 | 750 |
]. |
751 |
eventListener notNil ifTrue:[ |
|
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
752 |
(eventListener buttonRelease:button x:x y:y view:aView) ifTrue:[^ self] |
244 | 753 |
]. |
754 |
||
755 |
ignoreUserInput == true ifTrue:[ |
|
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
756 |
^ self |
244 | 757 |
]. |
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
758 |
|
1861
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
759 |
ev := WindowEvent buttonEvent |
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
760 |
for:aView |
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
761 |
type:#buttonRelease:x:y: |
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
762 |
arguments:(Array with:button with:x with:y). |
1862
e56d9a7389bb
also remember buttonStates in keyEvents.
Claus Gittinger <cg@exept.de>
parents:
1861
diff
changeset
|
763 |
ev hasShift:shiftDown ctrl:ctrlDown alt:altDown meta:metaDown |
e56d9a7389bb
also remember buttonStates in keyEvents.
Claus Gittinger <cg@exept.de>
parents:
1861
diff
changeset
|
764 |
button1:leftButtonDown button2:middleButtonDown button3:rightButtonDown. |
1861
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
765 |
self pushEvent:ev. |
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
766 |
|
1862
e56d9a7389bb
also remember buttonStates in keyEvents.
Claus Gittinger <cg@exept.de>
parents:
1861
diff
changeset
|
767 |
"Modified: 13.8.1997 / 22:19:16 / cg" |
244 | 768 |
! |
769 |
||
1545 | 770 |
clientMessage:type format:format eventData:data view:aView |
771 |
"some other data sent to a view. |
|
772 |
This is an X-specific event." |
|
773 |
||
774 |
self pushEvent:(WindowEvent clientEvent |
|
775 |
for:aView |
|
776 |
type:#clientMessage:format:eventData: |
|
777 |
arguments:(Array with:type with:format with:data)). |
|
778 |
||
779 |
"Created: 4.4.1997 / 17:51:08 / cg" |
|
780 |
"Modified: 4.4.1997 / 18:53:50 / cg" |
|
781 |
! |
|
782 |
||
244 | 783 |
configureX:x y:y width:w height:h view:aView |
784 |
"a views size or position has changed - this is sent from the device (Display)" |
|
785 |
||
1108
748f9e5c5b1e
ignore configureEvents for subviews.
Claus Gittinger <cg@exept.de>
parents:
1100
diff
changeset
|
786 |
aView superView notNil ifTrue:[ |
1969
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
787 |
"/ this is a configure event for a subView |
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
788 |
"/ I guess, this resulted from a resize of |
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
789 |
"/ myself (are there any windowManagers which resize subviews ?) |
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
790 |
"/ Therefore, ignore it here. |
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
791 |
"/ This also fixed problems due to late-arriving configure events, |
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
792 |
"/ in case of a resized view, which was resized before. |
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
793 |
"/ Without the return below, we need a flushConfigureEvents entry here, |
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
794 |
"/ to be invoked whenever a subview is resized / repositioned. |
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
795 |
|
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
796 |
^ self |
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
797 |
]. |
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
798 |
|
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
799 |
"/ |
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
800 |
"/ experimental: only queue one confif event (WIN32 speedup) |
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
801 |
"/ |
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
802 |
damage size ~~ 0 ifTrue:[ |
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
803 |
damage do:[:aDamage | |
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
804 |
aDamage notNil ifTrue:[ |
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
805 |
aDamage type == #configureX:y:width:height: ifTrue:[ |
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
806 |
aDamage view == aView ifTrue:[ |
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
807 |
aDamage |
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
808 |
arguments:(Array with:x with:y with:w with:h). |
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
809 |
^ false |
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
810 |
] |
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
811 |
] |
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
812 |
]. |
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
813 |
] |
1108
748f9e5c5b1e
ignore configureEvents for subviews.
Claus Gittinger <cg@exept.de>
parents:
1100
diff
changeset
|
814 |
]. |
748f9e5c5b1e
ignore configureEvents for subviews.
Claus Gittinger <cg@exept.de>
parents:
1100
diff
changeset
|
815 |
|
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
816 |
self pushDamageEvent:(WindowEvent |
1969
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
817 |
for:aView |
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
818 |
type:#configureX:y:width:height: |
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
819 |
arguments:(Array with:x with:y with:w with:h)). |
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
820 |
|
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
821 |
"Modified: / 8.12.1997 / 19:16:12 / cg" |
244 | 822 |
! |
823 |
||
824 |
coveredBy:sibling view:aView |
|
825 |
"aView was covered by one of its siblings - this is sent from the device (Display)" |
|
826 |
||
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
827 |
self pushDamageEvent:(WindowEvent |
1271 | 828 |
for:aView |
829 |
type:#coveredBy: |
|
830 |
arguments:(Array with:sibling)). |
|
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
831 |
|
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
832 |
"Modified: 18.1.1997 / 14:18:32 / cg" |
244 | 833 |
! |
834 |
||
835 |
destroyedView:aView |
|
836 |
"view was destroyed (from window manager) - this is sent from the device (Display)" |
|
837 |
||
838 |
"at this time, the view is already gone; remove |
|
839 |
all pending events for this one ..." |
|
840 |
||
841 |
self flushEventsFor:aView. |
|
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
842 |
self pushDamageEvent:(WindowEvent |
1271 | 843 |
for:aView |
844 |
type:#destroyed). |
|
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
845 |
|
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
846 |
"Modified: 18.1.1997 / 14:18:19 / cg" |
244 | 847 |
! |
848 |
||
1545 | 849 |
dropMessage:dropType data:dropValue view:aView |
850 |
"a drop sent to a view. The dropType is a symbolic specifier, |
|
851 |
which may be ignored, since the dropValue has already been |
|
852 |
converted into an ST/X dropObject." |
|
853 |
||
854 |
self pushEvent:(WindowEvent |
|
855 |
for:aView |
|
856 |
type:#dropMessage:data: |
|
857 |
arguments:(Array with:dropType with:dropValue)). |
|
858 |
||
859 |
"Created: 4.4.1997 / 18:13:41 / cg" |
|
860 |
"Modified: 4.4.1997 / 18:55:25 / cg" |
|
861 |
! |
|
862 |
||
244 | 863 |
exposeX:left y:top width:width height:height view:aView |
864 |
"an expose event arrived - this is sent from the device (Display)" |
|
865 |
||
1851
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
866 |
|didEnq| |
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
867 |
|
703
4324ab5e3630
added facility to lock expose event queue (temporary kludge ?)
Claus Gittinger <cg@exept.de>
parents:
612
diff
changeset
|
868 |
ignoreExposeEvents ~~ true ifTrue:[ |
1851
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
869 |
didEnq := |
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
870 |
self addDamage:(Rectangle left:left top:top width:width height:height) |
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
871 |
view:aView |
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
872 |
wakeup:true. |
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
873 |
] ifFalse:[ |
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
874 |
'ignored expose' printCR |
244 | 875 |
] |
703
4324ab5e3630
added facility to lock expose event queue (temporary kludge ?)
Claus Gittinger <cg@exept.de>
parents:
612
diff
changeset
|
876 |
|
1851
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
877 |
"Modified: 6.8.1997 / 20:31:22 / cg" |
140 | 878 |
! |
879 |
||
880 |
focusInView:aView |
|
881 |
"view got input focus - this is sent from the device (Display)" |
|
882 |
||
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
883 |
self pushEvent:(WindowEvent |
1331 | 884 |
for:aView |
885 |
type:#focusIn). |
|
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
886 |
|
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
887 |
"Modified: 18.1.1997 / 14:07:01 / cg" |
140 | 888 |
! |
889 |
||
244 | 890 |
focusOutView:aView |
891 |
"view lost input focus - this is sent from the device (Display)" |
|
140 | 892 |
|
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
893 |
self pushEvent:(WindowEvent |
1331 | 894 |
for:aView |
895 |
type:#focusOut). |
|
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
896 |
|
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
897 |
"Modified: 18.1.1997 / 14:07:09 / cg" |
140 | 898 |
! |
899 |
||
1295
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
900 |
graphicsExposeX:left y:top width:width height:height final:final view:aView |
244 | 901 |
"a graphic expose event arrived - this is sent from the device (Display)" |
140 | 902 |
|
1243
0c33cb7f8458
hopefully fixed the 'lost expose' bug
Claus Gittinger <cg@exept.de>
parents:
1242
diff
changeset
|
903 |
"/ this is also a possible response to a scroll operation |
0c33cb7f8458
hopefully fixed the 'lost expose' bug
Claus Gittinger <cg@exept.de>
parents:
1242
diff
changeset
|
904 |
"/ (if an expose is pending) |
0c33cb7f8458
hopefully fixed the 'lost expose' bug
Claus Gittinger <cg@exept.de>
parents:
1242
diff
changeset
|
905 |
|
1295
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
906 |
final ifTrue:[ |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
907 |
(catchExpose includes:aView) ifTrue:[ |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
908 |
gotExpose add:aView. |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
909 |
exposeEventSemaphore signalForAll |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
910 |
] ifFalse:[ |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
911 |
'WSensor [warning]: got exposeEvent for non-catching view:' infoPrint. aView infoPrintCR |
1271 | 912 |
] |
1243
0c33cb7f8458
hopefully fixed the 'lost expose' bug
Claus Gittinger <cg@exept.de>
parents:
1242
diff
changeset
|
913 |
]. |
0c33cb7f8458
hopefully fixed the 'lost expose' bug
Claus Gittinger <cg@exept.de>
parents:
1242
diff
changeset
|
914 |
|
751 | 915 |
self addDamage:(left @ top extent:width @ height) view:aView wakeup:false. |
916 |
||
1268
612204a36c38
no, regular expose events should not trigger the exposeSema
Claus Gittinger <cg@exept.de>
parents:
1264
diff
changeset
|
917 |
"Modified: 23.1.1997 / 22:15:53 / cg" |
140 | 918 |
! |
919 |
||
920 |
keyPress:key x:x y:y view:aView |
|
921 |
"key was pressed - this is sent from the device (Display). |
|
922 |
beside the keyboard translation, CntlC processing is done here." |
|
923 |
||
510 | 924 |
<resource: #keyboard ( #Compose #DestroyView #DestroyTopView #FlushInput |
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
925 |
#UserInterrupt ) > |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
926 |
|
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
927 |
|xlatedKey group process ev| |
140 | 928 |
|
144 | 929 |
self key:key state:true. |
930 |
||
140 | 931 |
EventListener notNil ifTrue:[ |
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
932 |
(EventListener keyPress:key x:x y:y view:aView) ifTrue:[^ self] |
140 | 933 |
]. |
934 |
eventListener notNil ifTrue:[ |
|
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
935 |
(eventListener keyPress:key x:x y:y view:aView) ifTrue:[^ self] |
140 | 936 |
]. |
937 |
keyboardListener notNil ifTrue:[ |
|
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
938 |
(keyboardListener keyPress:key x:x y:y view:aView) ifTrue:[^ self] |
140 | 939 |
]. |
940 |
||
941 |
translateKeyboardEvents ifTrue:[ |
|
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
942 |
xlatedKey := aView graphicsDevice translateKey:key. |
140 | 943 |
] ifFalse:[ |
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
944 |
xlatedKey := key. |
140 | 945 |
]. |
157 | 946 |
|
140 | 947 |
xlatedKey isNil ifTrue:[^ self]. |
948 |
||
157 | 949 |
(xlatedKey == #Compose) ifTrue:[ |
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
950 |
GotCompose := true. Compose1 := nil. |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
951 |
^ self |
157 | 952 |
]. |
953 |
GotCompose == true ifTrue:[ |
|
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
954 |
Compose1 isNil ifTrue:[ |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
955 |
(self isModifierKey:xlatedKey) ifFalse:[ |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
956 |
Compose1 := xlatedKey. |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
957 |
]. |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
958 |
^ self |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
959 |
]. |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
960 |
(self isModifierKey:xlatedKey) ifFalse:[ |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
961 |
xlatedKey := self compose:Compose1 with:xlatedKey. |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
962 |
Compose1 := nil. GotCompose := false. |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
963 |
] |
157 | 964 |
]. |
965 |
||
966 |
(xlatedKey == #CmdCtrlV) ifTrue:[ |
|
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
967 |
'Smalltalk/X ' errorPrint. |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
968 |
Smalltalk versionString errorPrint. ' of ' errorPrint. |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
969 |
Smalltalk versionDate errorPrintCR. |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
970 |
Smalltalk copyrightString errorPrintCR. |
140 | 971 |
]. |
972 |
||
157 | 973 |
(xlatedKey == #DestroyView) ifTrue:[ |
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
974 |
aView closeRequest. |
157 | 975 |
]. |
976 |
(xlatedKey == #DestroyTopView) ifTrue:[ |
|
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
977 |
aView topView closeRequest. |
157 | 978 |
]. |
979 |
||
152 | 980 |
(xlatedKey == #FlushInput) ifTrue:[ |
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
981 |
"this removes any enqueued user events - |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
982 |
helps, if you pressed DoIt too often, and want to flush those |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
983 |
" |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
984 |
self flushUserEvents. |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
985 |
^ self |
152 | 986 |
]. |
987 |
||
140 | 988 |
((xlatedKey == #UserInterrupt) and:[ControlCEnabled]) ifTrue:[ |
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
989 |
" |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
990 |
Special handling for Ctrl-C: interrupt the underlying process. |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
991 |
|
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
992 |
cannot halt here (this would stop the event-dispatcher), |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
993 |
but instead interrupt the underlying process and have it |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
994 |
perform the userInterrupt in the interrupt-method. |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
995 |
" |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
996 |
group := aView windowGroup. |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
997 |
group notNil ifTrue:[ |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
998 |
process := group process. |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
999 |
process notNil ifTrue:[ |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1000 |
process interruptWith:[:where | process userInterruptIn:where] |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1001 |
] |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1002 |
]. |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1003 |
^ self |
140 | 1004 |
]. |
1005 |
||
1006 |
ignoreUserInput == true ifTrue:[ |
|
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1007 |
^ self |
140 | 1008 |
]. |
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1009 |
|
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1010 |
ev := WindowEvent keyboardEvent |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1011 |
for:aView |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1012 |
type:#keyPress:x:y: |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1013 |
arguments:(Array with:xlatedKey with:x with:y). |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1014 |
ev rawKey:key. |
1862
e56d9a7389bb
also remember buttonStates in keyEvents.
Claus Gittinger <cg@exept.de>
parents:
1861
diff
changeset
|
1015 |
ev hasShift:shiftDown ctrl:ctrlDown alt:altDown meta:metaDown |
e56d9a7389bb
also remember buttonStates in keyEvents.
Claus Gittinger <cg@exept.de>
parents:
1861
diff
changeset
|
1016 |
button1:leftButtonDown button2:middleButtonDown button3:rightButtonDown. |
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1017 |
self pushEvent:ev. |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1018 |
|
1862
e56d9a7389bb
also remember buttonStates in keyEvents.
Claus Gittinger <cg@exept.de>
parents:
1861
diff
changeset
|
1019 |
"Modified: 13.8.1997 / 22:19:19 / cg" |
140 | 1020 |
! |
1021 |
||
1022 |
keyRelease:key x:x y:y view:aView |
|
1023 |
"key was released - this is sent from the device (Display)." |
|
1024 |
||
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1025 |
|xlatedKey ev| |
140 | 1026 |
|
144 | 1027 |
self key:key state:false. |
1028 |
||
140 | 1029 |
EventListener notNil ifTrue:[ |
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1030 |
(EventListener keyRelease:key x:x y:y view:aView) ifTrue:[^ self] |
140 | 1031 |
]. |
1032 |
eventListener notNil ifTrue:[ |
|
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1033 |
(eventListener keyRelease:key x:x y:y view:aView) ifTrue:[^ self] |
140 | 1034 |
]. |
1035 |
keyboardListener notNil ifTrue:[ |
|
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1036 |
(keyboardListener keyRelease:key x:x y:y view:aView) ifTrue:[^ self] |
140 | 1037 |
]. |
1038 |
||
1039 |
ignoreUserInput == true ifTrue:[ |
|
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1040 |
^ self |
140 | 1041 |
]. |
1042 |
translateKeyboardEvents ifTrue:[ |
|
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1043 |
xlatedKey := aView graphicsDevice translateKey:key. |
140 | 1044 |
] ifFalse:[ |
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1045 |
xlatedKey := key. |
140 | 1046 |
]. |
1047 |
xlatedKey isNil ifTrue:[^ self]. |
|
1048 |
||
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1049 |
ev := WindowEvent keyboardEvent |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1050 |
for:aView |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1051 |
type:#keyRelease:x:y: |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1052 |
arguments:(Array with:xlatedKey with:x with:y). |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1053 |
ev rawKey:key. |
1862
e56d9a7389bb
also remember buttonStates in keyEvents.
Claus Gittinger <cg@exept.de>
parents:
1861
diff
changeset
|
1054 |
ev hasShift:shiftDown ctrl:ctrlDown alt:altDown meta:metaDown |
e56d9a7389bb
also remember buttonStates in keyEvents.
Claus Gittinger <cg@exept.de>
parents:
1861
diff
changeset
|
1055 |
button1:leftButtonDown button2:middleButtonDown button3:rightButtonDown. |
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1056 |
|
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1057 |
self pushEvent:ev. |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1058 |
|
1862
e56d9a7389bb
also remember buttonStates in keyEvents.
Claus Gittinger <cg@exept.de>
parents:
1861
diff
changeset
|
1059 |
"Modified: 13.8.1997 / 22:19:22 / cg" |
140 | 1060 |
! |
1061 |
||
244 | 1062 |
mappedView:aView |
1063 |
"view was mapped (from window manager) - this is sent from the device (Display)" |
|
140 | 1064 |
|
2058
59a52789086a
fixed (I hope) redraw bug in debugView
Claus Gittinger <cg@exept.de>
parents:
2052
diff
changeset
|
1065 |
self flushExposeEventsFor:aView. |
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1066 |
self pushDamageEvent:(WindowEvent |
1851
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1067 |
for:aView |
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1068 |
type:#mapped). |
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1069 |
|
2058
59a52789086a
fixed (I hope) redraw bug in debugView
Claus Gittinger <cg@exept.de>
parents:
2052
diff
changeset
|
1070 |
"Modified: / 16.2.1998 / 13:20:41 / cg" |
244 | 1071 |
! |
1072 |
||
1073 |
noExposeView:aView |
|
1074 |
"an noexpose event arrived - this is sent from the device (Display)" |
|
1075 |
||
1295
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
1076 |
(catchExpose includes:aView) ifTrue:[ |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
1077 |
gotExpose add:aView. |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
1078 |
exposeEventSemaphore signalForAll |
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1079 |
] ifFalse:[ |
1295
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
1080 |
'WSensor [warning]: got noExpose for non-catching view:' infoPrint. aView infoPrintCR |
244 | 1081 |
] |
1082 |
! |
|
1083 |
||
1340
f028f125f606
pasteFromClipBoard: must go through the sensor
Claus Gittinger <cg@exept.de>
parents:
1331
diff
changeset
|
1084 |
pasteFromClipBoard:something view:aView |
f028f125f606
pasteFromClipBoard: must go through the sensor
Claus Gittinger <cg@exept.de>
parents:
1331
diff
changeset
|
1085 |
"a clipboard paste - this is handled like a user event" |
f028f125f606
pasteFromClipBoard: must go through the sensor
Claus Gittinger <cg@exept.de>
parents:
1331
diff
changeset
|
1086 |
|
f028f125f606
pasteFromClipBoard: must go through the sensor
Claus Gittinger <cg@exept.de>
parents:
1331
diff
changeset
|
1087 |
self pushEvent:(WindowEvent |
f028f125f606
pasteFromClipBoard: must go through the sensor
Claus Gittinger <cg@exept.de>
parents:
1331
diff
changeset
|
1088 |
for:aView |
f028f125f606
pasteFromClipBoard: must go through the sensor
Claus Gittinger <cg@exept.de>
parents:
1331
diff
changeset
|
1089 |
type:#pasteFromClipBoard: |
f028f125f606
pasteFromClipBoard: must go through the sensor
Claus Gittinger <cg@exept.de>
parents:
1331
diff
changeset
|
1090 |
arguments:(Array with:something)). |
f028f125f606
pasteFromClipBoard: must go through the sensor
Claus Gittinger <cg@exept.de>
parents:
1331
diff
changeset
|
1091 |
|
f028f125f606
pasteFromClipBoard: must go through the sensor
Claus Gittinger <cg@exept.de>
parents:
1331
diff
changeset
|
1092 |
"Modified: 18.1.1997 / 14:07:25 / cg" |
f028f125f606
pasteFromClipBoard: must go through the sensor
Claus Gittinger <cg@exept.de>
parents:
1331
diff
changeset
|
1093 |
"Created: 13.2.1997 / 13:40:24 / cg" |
f028f125f606
pasteFromClipBoard: must go through the sensor
Claus Gittinger <cg@exept.de>
parents:
1331
diff
changeset
|
1094 |
! |
f028f125f606
pasteFromClipBoard: must go through the sensor
Claus Gittinger <cg@exept.de>
parents:
1331
diff
changeset
|
1095 |
|
244 | 1096 |
pointerEnter:state x:x y:y view:aView |
1097 |
"mouse cursor was moved into the view - this is sent from the device (Display)" |
|
1098 |
||
1864
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1099 |
|ev| |
244 | 1100 |
|
1100 | 1101 |
"/ update my idea of shift/alt/ctrl pressed information |
1102 |
self updateModifierStateFrom:state device:(aView graphicsDevice). |
|
1103 |
||
244 | 1104 |
EventListener notNil ifTrue:[ |
1864
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1105 |
(EventListener pointerEnter:state x:x y:y view:aView) ifTrue:[^ self] |
244 | 1106 |
]. |
1107 |
eventListener notNil ifTrue:[ |
|
1864
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1108 |
(eventListener pointerEnter:state x:x y:y view:aView) ifTrue:[^ self] |
244 | 1109 |
]. |
1110 |
||
1864
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1111 |
ev := WindowEvent inputEvent |
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1112 |
for:aView |
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1113 |
type:#pointerEnter:x:y: |
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1114 |
arguments:(Array with:state with:x with:y). |
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1115 |
|
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1116 |
ev hasShift:shiftDown ctrl:ctrlDown alt:altDown meta:metaDown |
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1117 |
button1:leftButtonDown button2:middleButtonDown button3:rightButtonDown. |
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1118 |
self pushEvent:ev. |
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1119 |
|
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1120 |
"Modified: 13.8.1997 / 23:04:09 / cg" |
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1121 |
! |
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1122 |
|
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1123 |
pointerLeave:state view:aView |
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1124 |
"mouse cursor was moved out of the view - this is sent from the device (Display)" |
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1125 |
|
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1126 |
|ev| |
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1127 |
|
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1128 |
"/ update my idea of shift/alt/ctrl pressed information |
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1129 |
self updateModifierStateFrom:state device:(aView graphicsDevice). |
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1130 |
|
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1131 |
EventListener notNil ifTrue:[ |
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1132 |
(EventListener pointerLeave:state view:aView) ifTrue:[^ self] |
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1133 |
]. |
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1134 |
eventListener notNil ifTrue:[ |
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1135 |
(eventListener pointerLeave:state view:aView) ifTrue:[^ self] |
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1136 |
]. |
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1137 |
|
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1138 |
ev := WindowEvent inputEvent |
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1139 |
for:aView |
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1140 |
type:#pointerLeave: |
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1141 |
arguments:(Array with:state). |
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1142 |
|
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1143 |
ev hasShift:shiftDown ctrl:ctrlDown alt:altDown meta:metaDown |
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1144 |
button1:leftButtonDown button2:middleButtonDown button3:rightButtonDown. |
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1145 |
self pushEvent:ev. |
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1146 |
|
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1147 |
"Modified: 13.8.1997 / 23:04:13 / cg" |
140 | 1148 |
! |
1149 |
||
1150 |
saveAndTerminateView:aView |
|
1151 |
"view should save & terminate (from window manager) - this is sent from the device (Display)" |
|
1152 |
||
1153 |
self flushEventsFor:aView. |
|
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1154 |
self pushDamageEvent:(WindowEvent |
1271 | 1155 |
for:aView |
1156 |
type:#saveAndTerminate). |
|
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1157 |
|
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1158 |
"Modified: 18.1.1997 / 14:17:37 / cg" |
140 | 1159 |
! |
1160 |
||
244 | 1161 |
terminateView:aView |
1162 |
"view should terminate (from window manager) - this is sent from the device (Display)" |
|
140 | 1163 |
|
1164 |
self flushEventsFor:aView. |
|
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1165 |
self pushDamageEvent:(WindowEvent |
1271 | 1166 |
for:aView |
1167 |
type:#terminate). |
|
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1168 |
|
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1169 |
"Modified: 18.1.1997 / 14:17:24 / cg" |
244 | 1170 |
! |
1171 |
||
1172 |
unmappedView:aView |
|
1173 |
"view was unmapped (from window manager) - this is sent from the device (Display)" |
|
1174 |
||
2058
59a52789086a
fixed (I hope) redraw bug in debugView
Claus Gittinger <cg@exept.de>
parents:
2052
diff
changeset
|
1175 |
self flushExposeEventsFor:aView. |
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1176 |
self pushDamageEvent:(WindowEvent |
2058
59a52789086a
fixed (I hope) redraw bug in debugView
Claus Gittinger <cg@exept.de>
parents:
2052
diff
changeset
|
1177 |
for:aView |
59a52789086a
fixed (I hope) redraw bug in debugView
Claus Gittinger <cg@exept.de>
parents:
2052
diff
changeset
|
1178 |
type:#unmapped). |
59a52789086a
fixed (I hope) redraw bug in debugView
Claus Gittinger <cg@exept.de>
parents:
2052
diff
changeset
|
1179 |
|
59a52789086a
fixed (I hope) redraw bug in debugView
Claus Gittinger <cg@exept.de>
parents:
2052
diff
changeset
|
1180 |
"Modified: / 16.2.1998 / 13:20:37 / cg" |
0 | 1181 |
! ! |
1182 |
||
581 | 1183 |
!WindowSensor methodsFor:'event processing - private'! |
1184 |
||
1185 |
button:button inView:aView state:onOrOff |
|
1186 |
"update the state of the xxxButtonDown flags" |
|
1187 |
||
1188 |
|physicalButton| |
|
1189 |
||
743 | 1190 |
physicalButton := aView graphicsDevice buttonTranslation keyAtValue:button ifAbsent:button. |
1084 | 1191 |
|
581 | 1192 |
(physicalButton == 1) ifTrue:[ |
1271 | 1193 |
leftButtonDown := onOrOff. |
1194 |
^ self |
|
581 | 1195 |
]. |
1196 |
(physicalButton == 2) ifTrue:[ |
|
1271 | 1197 |
middleButtonDown := onOrOff. |
1198 |
^ self |
|
581 | 1199 |
]. |
1200 |
(physicalButton == 3) ifTrue:[ |
|
1271 | 1201 |
rightButtonDown := onOrOff. |
1202 |
^ self |
|
581 | 1203 |
]. |
743 | 1204 |
|
1084 | 1205 |
"Modified: 21.10.1996 / 11:47:35 / cg" |
581 | 1206 |
! |
1207 |
||
1208 |
compose:key1 with:key2 |
|
1209 |
"compose a 2-character sequence into a composed key" |
|
1210 |
||
1211 |
ComposeTable do:[:entry | |
|
1212 |
|v| |
|
1213 |
||
1214 |
((key1 == (entry at:1)) and:[key2 == (entry at:2)]) ifTrue:[ |
|
1215 |
v := entry at:3. |
|
1216 |
v isCharacter ifFalse:[v := Character value:v]. |
|
1217 |
^ v |
|
1218 |
] |
|
1219 |
]. |
|
1220 |
"/ |
|
1221 |
"/ for illegal sequence, return 2nd key |
|
1222 |
"/ |
|
1223 |
"/ key1 print. ' ' print. key2 printNL. |
|
1224 |
^ key2 |
|
1225 |
! |
|
1226 |
||
1227 |
isModifierKey:key |
|
1228 |
"return true if key is a modifier (Alt, Shift, Ctrl or Meta)" |
|
1229 |
||
1230 |
(key == #Shift |
|
1231 |
or:[key == #'Shift_R' |
|
1232 |
or:[key == #'Shift_L']]) ifTrue:[ |
|
1271 | 1233 |
^ true |
581 | 1234 |
]. |
1235 |
(key == #Alt |
|
1236 |
or:[key == #'Alt_R' or:[key == #'Alt_L']]) ifTrue:[ |
|
1271 | 1237 |
^ true |
581 | 1238 |
]. |
1239 |
(key == #Meta |
|
1240 |
or:[key == #'Meta_R' or:[key == #'Meta_L']]) ifTrue:[ |
|
1271 | 1241 |
^ true |
581 | 1242 |
]. |
1243 |
(key == #Control |
|
1244 |
or:[key == #'Control_R' or:[key == #'Control_L']]) ifTrue:[ |
|
1271 | 1245 |
^ true |
581 | 1246 |
]. |
1247 |
^ false |
|
1248 |
||
1249 |
"Modified: 22.4.1996 / 16:22:16 / cg" |
|
1250 |
! |
|
1251 |
||
1252 |
key:key state:onOrOff |
|
1253 |
"update the state of the shiftDown/metaDown and ctrlDown |
|
1254 |
flags" |
|
1255 |
||
1256 |
(key = #Shift |
|
1257 |
or:[key = #'Shift_R' |
|
1258 |
or:[key = #'Shift_L']]) ifTrue:[ |
|
1259 |
shiftDown := onOrOff. |
|
1260 |
^ self |
|
1261 |
]. |
|
1262 |
(key = #Alt |
|
1263 |
or:[key = #'Alt_R' or:[key = #'Alt_L']]) ifTrue:[ |
|
1264 |
altDown := onOrOff. |
|
1265 |
^ self |
|
1266 |
]. |
|
1267 |
(key = #Meta |
|
1268 |
or:[key = #'Meta_R' or:[key = #'Meta_L']]) ifTrue:[ |
|
1269 |
metaDown := onOrOff. |
|
1270 |
^ self |
|
1271 |
]. |
|
1272 |
(key = #Control |
|
1273 |
or:[key = #'Control_R' or:[key = #'Control_L']]) ifTrue:[ |
|
1274 |
ctrlDown := onOrOff. |
|
1275 |
^ self |
|
1276 |
]. |
|
1277 |
! |
|
1278 |
||
1295
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
1279 |
notifyEventArrival:aView |
581 | 1280 |
"an event arrived - if there is an eventSemaphore, |
1281 |
signal it, to wake up any windowGroup process" |
|
1282 |
||
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1283 |
(catchExpose includesIdentical:aView) ifTrue:[ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1284 |
" |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1285 |
dont wake up, if we are currently waiting for an expose |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1286 |
but remember arrival of something. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1287 |
" |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1288 |
gotOtherEvent add:aView. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1289 |
^ self |
581 | 1290 |
]. |
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1291 |
|
581 | 1292 |
eventSemaphore notNil ifTrue:[ |
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1293 |
"/ eventSemaphore signal |
1184
1372bad824af
single trigger on the eventSemaphore is ok
Claus Gittinger <cg@exept.de>
parents:
1179
diff
changeset
|
1294 |
|
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1295 |
"/ can get along with a single trigger; |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1296 |
"/ because processEvents will read all events |
1184
1372bad824af
single trigger on the eventSemaphore is ok
Claus Gittinger <cg@exept.de>
parents:
1179
diff
changeset
|
1297 |
|
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1298 |
eventSemaphore signalOnce |
581 | 1299 |
] |
1184
1372bad824af
single trigger on the eventSemaphore is ok
Claus Gittinger <cg@exept.de>
parents:
1179
diff
changeset
|
1300 |
|
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1301 |
"Modified: 8.2.1997 / 12:01:48 / cg" |
581 | 1302 |
! |
1303 |
||
1304 |
updateModifierStateFrom:state device:aDevice |
|
1305 |
"this refetches the modifier key-states. |
|
1306 |
Called privately when pointer enters a view." |
|
1307 |
||
1308 |
"/ Prevents wrong behavior in the following scenario: |
|
1309 |
"/ ctrl is pressed in a view |
|
1310 |
"/ pointer is moved out of view |
|
1311 |
"/ ctrl is released |
|
1312 |
"/ pointer moved back into view |
|
1313 |
"/ popup-menu still thinks that ctrl is pressed" |
|
1314 |
||
1100 | 1315 |
shiftDown := "state bitAnd:(aDevice shiftMask) " aDevice shiftDown. |
1316 |
ctrlDown := "state bitAnd:(aDevice controlMask) " aDevice ctrlDown. |
|
1317 |
metaDown := "state bitAnd:(aDevice metaModifierMask) " aDevice metaDown. |
|
1318 |
altDown := "state bitAnd:(aDevice altModifierMask) " aDevice altDown. |
|
1319 |
||
1320 |
leftButtonDown := "state bitAnd:(aDevice leftButtonStateMask) " aDevice leftButtonPressed. |
|
1321 |
middleButtonDown := "state bitAnd:(aDevice middleButtonStateMask)" aDevice middleButtonPressed. |
|
1322 |
rightButtonDown := "state bitAnd:(aDevice rightButtonStateMask)" aDevice rightButtonPressed. |
|
581 | 1323 |
|
1324 |
"Created: 27.2.1996 / 14:54:38 / cg" |
|
1100 | 1325 |
"Modified: 1.11.1996 / 16:51:47 / cg" |
581 | 1326 |
! ! |
1327 |
||
140 | 1328 |
!WindowSensor methodsFor:'event queue'! |
1329 |
||
144 | 1330 |
addDamage:aRectangle view:aView |
1318 | 1331 |
"{ Pragma: +optSpeed }" |
1332 |
||
0 | 1333 |
"Add aRectangle to the damage list. |
144 | 1334 |
Try to merge incoming rectangles with the existing damage rectangles. |
1335 |
Incoming rectangles which are completely contained in any existing damage rect are ignored, |
|
1336 |
any existing damage rectangle which is completely contained in the incoming rectangle |
|
152 | 1337 |
is replaced. Also, rectangles are merged into bigger ones, if they join exactly. |
144 | 1338 |
Except for special cases (moveOpaque of a view over one of my views), |
1339 |
these optimizations are not noticable." |
|
0 | 1340 |
|
751 | 1341 |
^ self addDamage:aRectangle view:aView wakeup:true |
1342 |
||
1343 |
"Modified: 28.5.1996 / 21:52:47 / cg" |
|
1344 |
! |
|
1345 |
||
1346 |
addDamage:aRectangle view:aView wakeup:doWakeup |
|
1317 | 1347 |
"{ Pragma: +optSpeed }" |
1348 |
||
751 | 1349 |
"Add aRectangle to the damage list. |
1350 |
Try to merge incoming rectangles with the existing damage rectangles. |
|
1351 |
Incoming rectangles which are completely contained in any existing damage rect are ignored, |
|
1352 |
any existing damage rectangle which is completely contained in the incoming rectangle |
|
1353 |
is replaced. Also, rectangles are merged into bigger ones, if they join exactly. |
|
1354 |
Except for special cases (moveOpaque of a view over one of my views), |
|
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1355 |
these optimizations are not noticable. |
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1356 |
Returns true, if a new event has been added to the queue, false if it |
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1357 |
was optimized away." |
751 | 1358 |
|
1492
cb0118ee73e3
avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents:
1412
diff
changeset
|
1359 |
|ret| |
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1360 |
|
1492
cb0118ee73e3
avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents:
1412
diff
changeset
|
1361 |
ret := false. |
1847
f449f3009e88
need even more protection against process-interrupts
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
1362 |
self criticalEventQueueAccess:[ |
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1363 |
(self basicAddDamage:aRectangle view:aView) |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1364 |
ifTrue:[ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1365 |
doWakeup ifTrue:[ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1366 |
self notifyEventArrival:aView. |
1492
cb0118ee73e3
avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents:
1412
diff
changeset
|
1367 |
ret := true |
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1368 |
]. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1369 |
]. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1370 |
]. |
1492
cb0118ee73e3
avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents:
1412
diff
changeset
|
1371 |
^ ret |
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1372 |
|
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1373 |
"Created: 28.5.1996 / 21:51:16 / cg" |
1492
cb0118ee73e3
avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents:
1412
diff
changeset
|
1374 |
"Modified: 27.3.1997 / 16:11:56 / cg" |
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1375 |
! |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1376 |
|
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1377 |
basicAddDamage:aRectangle view:aView |
1317 | 1378 |
"{ Pragma: +optSpeed }" |
1379 |
||
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1380 |
"Add aRectangle to the damage list. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1381 |
Try to merge incoming rectangles with the existing damage rectangles. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1382 |
Incoming rectangles which are completely contained in any existing damage rect are ignored, |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1383 |
any existing damage rectangle which is completely contained in the incoming rectangle |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1384 |
is replaced. Also, rectangles are merged into bigger ones, if they join exactly. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1385 |
Except for special cases (moveOpaque of a view over one of my views), |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1386 |
these optimizations are not noticable. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1387 |
Returns true, if a new event has been added to the queue, false if it |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1388 |
was optimized away." |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1389 |
|
1616 | 1390 |
|temp index newEvent r fullRedraw |
2035
637bb684af6a
fixed ca's damage compression
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
1391 |
aDamage ev2 dRect stopSearch |
152 | 1392 |
count "{ Class: SmallInteger }" |
1393 |
sz "{ Class: SmallInteger }" |
|
1852 | 1394 |
firstInteresting |
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1395 |
lastInteresting "{ Class: SmallInteger }" |
1851
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1396 |
idx "{ Class: SmallInteger }" |
1616 | 1397 |
rL "{ Class: SmallInteger }" |
1398 |
rT "{ Class: SmallInteger }" |
|
1399 |
rB "{ Class: SmallInteger }" |
|
1400 |
rR "{ Class: SmallInteger }" |
|
1401 |
dL "{ Class: SmallInteger }" |
|
1402 |
dR "{ Class: SmallInteger }" |
|
1403 |
dT "{ Class: SmallInteger }" |
|
1404 |
dB "{ Class: SmallInteger }" |
|
1405 |
minX "{ Class: SmallInteger }" |
|
1406 |
minY "{ Class: SmallInteger }" |
|
1407 |
maxX "{ Class: SmallInteger }" |
|
1408 |
maxY "{ Class: SmallInteger }" |
|
1409 |
t "{ Class: SmallInteger }"| |
|
0 | 1410 |
|
152 | 1411 |
r := aRectangle. |
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1412 |
(fullRedraw := aView redrawsFull) ifTrue:[ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1413 |
r := 0@0 corner:9999@9999. |
488
97f384f5e2aa
views which always redraw full may say so in #redrawsFull
Claus Gittinger <cg@exept.de>
parents:
476
diff
changeset
|
1414 |
]. |
97f384f5e2aa
views which always redraw full may say so in #redrawsFull
Claus Gittinger <cg@exept.de>
parents:
476
diff
changeset
|
1415 |
|
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1416 |
sz := damage size. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1417 |
sz == 0 ifTrue: [ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1418 |
damage := OrderedCollection new:10. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1419 |
] ifFalse:[ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1420 |
" |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1421 |
first look, if this rectangle is already in the expose list; |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1422 |
if so, dont add to queue |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1423 |
On the fly, count the number of damages for this view |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1424 |
" |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1425 |
fullRedraw ifTrue:[ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1426 |
firstInteresting := 1. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1427 |
lastInteresting := sz. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1428 |
] ifFalse:[ |
1851
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1429 |
count := 0. |
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1430 |
firstInteresting := nil. |
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1431 |
|
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1432 |
"/ must search backward, break search with first |
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1433 |
"/ non-Expose (i.e. mapped/unmapped) |
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1434 |
|
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1435 |
stopSearch := false. |
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1436 |
idx := sz. |
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1437 |
[(idx > 0) and:[stopSearch not]] whileTrue:[ |
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1438 |
aDamage := damage at:idx. |
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1439 |
aDamage notNil ifTrue:[ |
2035
637bb684af6a
fixed ca's damage compression
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
1440 |
aDamage view == aView ifTrue:[ |
637bb684af6a
fixed ca's damage compression
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
1441 |
aDamage isDamage ifTrue:[ |
1851
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1442 |
((aDamage rectangle) contains:r) ifTrue:[ |
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1443 |
^ false |
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1444 |
]. |
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1445 |
count := count + 1. |
1851
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1446 |
lastInteresting := idx. |
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1447 |
firstInteresting isNil ifTrue:[ |
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1448 |
firstInteresting := idx |
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1449 |
] |
2035
637bb684af6a
fixed ca's damage compression
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
1450 |
] ifFalse:[ |
637bb684af6a
fixed ca's damage compression
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
1451 |
"/ if its a map/unmap, we can forget |
637bb684af6a
fixed ca's damage compression
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
1452 |
"/ any older damage event for this view ... |
637bb684af6a
fixed ca's damage compression
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
1453 |
(aDamage isUnmapEvent or:[aDamage isMapEvent]) ifTrue:[ |
2072
a9770eb53908
reenabled flushing of expose events before map/unmap event.
Claus Gittinger <cg@exept.de>
parents:
2058
diff
changeset
|
1454 |
idx := idx - 1. |
a9770eb53908
reenabled flushing of expose events before map/unmap event.
Claus Gittinger <cg@exept.de>
parents:
2058
diff
changeset
|
1455 |
[idx > 0] whileTrue:[ |
a9770eb53908
reenabled flushing of expose events before map/unmap event.
Claus Gittinger <cg@exept.de>
parents:
2058
diff
changeset
|
1456 |
ev2 := damage at:idx. |
a9770eb53908
reenabled flushing of expose events before map/unmap event.
Claus Gittinger <cg@exept.de>
parents:
2058
diff
changeset
|
1457 |
ev2 notNil ifTrue:[ |
a9770eb53908
reenabled flushing of expose events before map/unmap event.
Claus Gittinger <cg@exept.de>
parents:
2058
diff
changeset
|
1458 |
ev2 isDamage ifTrue:[ |
a9770eb53908
reenabled flushing of expose events before map/unmap event.
Claus Gittinger <cg@exept.de>
parents:
2058
diff
changeset
|
1459 |
ev2 view == aView ifTrue:[ |
a9770eb53908
reenabled flushing of expose events before map/unmap event.
Claus Gittinger <cg@exept.de>
parents:
2058
diff
changeset
|
1460 |
damage at:idx put:nil |
a9770eb53908
reenabled flushing of expose events before map/unmap event.
Claus Gittinger <cg@exept.de>
parents:
2058
diff
changeset
|
1461 |
] |
a9770eb53908
reenabled flushing of expose events before map/unmap event.
Claus Gittinger <cg@exept.de>
parents:
2058
diff
changeset
|
1462 |
] |
a9770eb53908
reenabled flushing of expose events before map/unmap event.
Claus Gittinger <cg@exept.de>
parents:
2058
diff
changeset
|
1463 |
]. |
a9770eb53908
reenabled flushing of expose events before map/unmap event.
Claus Gittinger <cg@exept.de>
parents:
2058
diff
changeset
|
1464 |
idx := idx - 1. |
a9770eb53908
reenabled flushing of expose events before map/unmap event.
Claus Gittinger <cg@exept.de>
parents:
2058
diff
changeset
|
1465 |
]. |
2035
637bb684af6a
fixed ca's damage compression
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
1466 |
stopSearch := true |
637bb684af6a
fixed ca's damage compression
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
1467 |
]. |
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1468 |
] |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1469 |
] |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1470 |
]. |
1851
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1471 |
idx := idx - 1. |
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1472 |
]. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1473 |
]. |
46 | 1474 |
|
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1475 |
" |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1476 |
are there any damages for this view in the queue ? |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1477 |
" |
1851
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1478 |
firstInteresting notNil ifTrue:[ |
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1479 |
" |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1480 |
if there are already many damages for this view, |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1481 |
remove them all, and replace by a full expose |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1482 |
This limits the runtime spent here, which may become big |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1483 |
due to the square runtime behavior (stupid algorithm ...) |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1484 |
" |
2022 | 1485 |
(fullRedraw or:[count > 10]) ifTrue:[ |
1616 | 1486 |
minX := r left. minY := r top. |
1487 |
maxX := r right. maxY := r bottom. |
|
1851
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1488 |
firstInteresting to:lastInteresting by:-1 do:[:i | |
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1489 |
aDamage := damage at:i. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1490 |
aDamage notNil ifTrue:[ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1491 |
aDamage isDamage ifTrue:[ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1492 |
(aDamage view) == aView ifTrue:[ |
1616 | 1493 |
dRect := aDamage rectangle. |
1494 |
(t := dRect left) < minX ifTrue:[minX := t]. |
|
1495 |
(t := dRect top) < minY ifTrue:[minY := t]. |
|
1496 |
(t := dRect right) > maxX ifTrue:[maxX := t]. |
|
1497 |
(t := dRect bottom) > maxY ifTrue:[maxY := t]. |
|
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1498 |
damage at:i put:nil. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1499 |
]. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1500 |
]. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1501 |
] |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1502 |
]. |
1616 | 1503 |
newEvent := WindowEvent |
1504 |
damageFor:aView |
|
1505 |
rectangle:(minX@minY corner:maxX@maxY). |
|
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1506 |
damage add:newEvent. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1507 |
^ true |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1508 |
]. |
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1509 |
|
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1510 |
" |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1511 |
then look, if the new rectangle contains any in the expose list; |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1512 |
if so, remove the old damage (here, by nilling it in the queue). |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1513 |
Or, merge it with existing rectangles if possible. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1514 |
" |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1515 |
count := 0. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1516 |
rR := r right. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1517 |
rL := r left. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1518 |
rT := r top. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1519 |
rB := r bottom. |
1851
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1520 |
firstInteresting to:lastInteresting by:-1 do:[:i | |
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1521 |
aDamage := damage at:i. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1522 |
aDamage notNil ifTrue:[ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1523 |
aDamage isDamage ifTrue:[ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1524 |
(aDamage view) == aView ifTrue:[ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1525 |
dRect := aDamage rectangle. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1526 |
(r contains:dRect) ifTrue: [ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1527 |
damage at:i put:nil. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1528 |
count := count + 1 |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1529 |
] ifFalse:[ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1530 |
dL := dRect left. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1531 |
dT := dRect top. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1532 |
dR := dRect right. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1533 |
dB := dRect bottom. |
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1534 |
|
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1535 |
(rT == dT |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1536 |
and:[rB == dB]) ifTrue:[ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1537 |
(rR > dR) ifTrue: [ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1538 |
(rL <= (dR + 1)) ifTrue: [ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1539 |
dRect right:rR. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1540 |
^ false |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1541 |
] |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1542 |
]. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1543 |
(rL < dL) ifTrue: [ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1544 |
(rR >= (dL - 1)) ifTrue: [ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1545 |
dRect left:rL. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1546 |
^ false |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1547 |
] |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1548 |
] |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1549 |
]. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1550 |
(rR == dR |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1551 |
and:[rL == dL]) ifTrue:[ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1552 |
(rB > dB) ifTrue: [ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1553 |
(rT <= (dB + 1)) ifTrue: [ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1554 |
dRect bottom:rB. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1555 |
^ false |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1556 |
] |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1557 |
]. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1558 |
(rT < dT) ifTrue: [ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1559 |
(rB >= (dT - 1)) ifTrue: [ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1560 |
dRect top:rT. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1561 |
^ false |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1562 |
] |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1563 |
] |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1564 |
] |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1565 |
] |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1566 |
] |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1567 |
] |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1568 |
] |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1569 |
]. |
152 | 1570 |
|
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1571 |
"/ " |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1572 |
"/ if we nilled more then 20 events, reorganize the queue |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1573 |
"/ (doing this for every 20 removes only avoids excessive |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1574 |
"/ reorganization of the input queue) |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1575 |
"/ " |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1576 |
"/ count > 20 ifTrue: [ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1577 |
"/ temp := OrderedCollection new:(sz - count + 1). |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1578 |
"/ index := 1. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1579 |
"/ 1 to:sz do:[:idx | |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1580 |
"/ aDamage := damage at:idx. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1581 |
"/ aDamage notNil ifTrue: [ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1582 |
"/ temp add:aDamage. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1583 |
"/ ] |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1584 |
"/ ]. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1585 |
"/ damage := temp |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1586 |
"/ ]. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1587 |
]. |
46 | 1588 |
]. |
1589 |
||
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1590 |
newEvent := WindowEvent damageFor:aView rectangle:r. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1591 |
damage add:newEvent. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1592 |
|
144 | 1593 |
^ true |
488
97f384f5e2aa
views which always redraw full may say so in #redrawsFull
Claus Gittinger <cg@exept.de>
parents:
476
diff
changeset
|
1594 |
|
2022 | 1595 |
"Created: / 8.2.1997 / 12:07:06 / cg" |
2072
a9770eb53908
reenabled flushing of expose events before map/unmap event.
Claus Gittinger <cg@exept.de>
parents:
2058
diff
changeset
|
1596 |
"Modified: / 27.2.1998 / 01:49:06 / cg" |
0 | 1597 |
! |
1598 |
||
428 | 1599 |
damage |
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1600 |
"return the damage event list" |
428 | 1601 |
|
1602 |
^ damage. |
|
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1603 |
|
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1604 |
"Modified: 18.1.1997 / 14:11:08 / cg" |
428 | 1605 |
! |
1606 |
||
244 | 1607 |
nextDamage |
703
4324ab5e3630
added facility to lock expose event queue (temporary kludge ?)
Claus Gittinger <cg@exept.de>
parents:
612
diff
changeset
|
1608 |
"retrieve the next damage (either expose or resize event) |
4324ab5e3630
added facility to lock expose event queue (temporary kludge ?)
Claus Gittinger <cg@exept.de>
parents:
612
diff
changeset
|
1609 |
or nil, if there is none. Remove it from the queue." |
244 | 1610 |
|
1492
cb0118ee73e3
avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents:
1412
diff
changeset
|
1611 |
|d foundOne| |
244 | 1612 |
|
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1613 |
damage size == 0 ifTrue:[^ nil]. |
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1614 |
|
1492
cb0118ee73e3
avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents:
1412
diff
changeset
|
1615 |
foundOne := false. |
cb0118ee73e3
avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents:
1412
diff
changeset
|
1616 |
[foundOne] whileFalse:[ |
cb0118ee73e3
avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents:
1412
diff
changeset
|
1617 |
" |
cb0118ee73e3
avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents:
1412
diff
changeset
|
1618 |
be careful: events are inserted at higher prio ... |
cb0118ee73e3
avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents:
1412
diff
changeset
|
1619 |
" |
1851
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1620 |
self criticalEventQueueAccess:[ |
1492
cb0118ee73e3
avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents:
1412
diff
changeset
|
1621 |
damage size == 0 ifTrue:[ |
cb0118ee73e3
avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents:
1412
diff
changeset
|
1622 |
foundOne := true |
cb0118ee73e3
avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents:
1412
diff
changeset
|
1623 |
] ifFalse:[ |
cb0118ee73e3
avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents:
1412
diff
changeset
|
1624 |
d := damage removeFirst. |
cb0118ee73e3
avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents:
1412
diff
changeset
|
1625 |
foundOne := d notNil. |
cb0118ee73e3
avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents:
1412
diff
changeset
|
1626 |
] |
cb0118ee73e3
avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents:
1412
diff
changeset
|
1627 |
] |
244 | 1628 |
]. |
1629 |
^ d |
|
476 | 1630 |
|
1851
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1631 |
"Modified: 6.8.1997 / 20:29:18 / cg" |
244 | 1632 |
! |
1633 |
||
1634 |
nextEvent |
|
1635 |
"retrieve the next event or nil, if there is none. |
|
1636 |
Remove it from the queue." |
|
1637 |
||
1492
cb0118ee73e3
avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents:
1412
diff
changeset
|
1638 |
|e foundOne| |
244 | 1639 |
|
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1640 |
mouseAndKeyboard size == 0 ifTrue:[^ nil]. |
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1641 |
|
1492
cb0118ee73e3
avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents:
1412
diff
changeset
|
1642 |
foundOne := false. |
cb0118ee73e3
avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents:
1412
diff
changeset
|
1643 |
[foundOne] whileFalse:[ |
cb0118ee73e3
avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents:
1412
diff
changeset
|
1644 |
" |
cb0118ee73e3
avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents:
1412
diff
changeset
|
1645 |
be careful: events are inserted at higher prio ... |
cb0118ee73e3
avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents:
1412
diff
changeset
|
1646 |
" |
1847
f449f3009e88
need even more protection against process-interrupts
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
1647 |
self criticalEventQueueAccess:[ |
1492
cb0118ee73e3
avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents:
1412
diff
changeset
|
1648 |
mouseAndKeyboard size == 0 ifTrue:[ |
cb0118ee73e3
avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents:
1412
diff
changeset
|
1649 |
foundOne := true |
cb0118ee73e3
avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents:
1412
diff
changeset
|
1650 |
] ifFalse:[ |
cb0118ee73e3
avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents:
1412
diff
changeset
|
1651 |
e := mouseAndKeyboard removeFirst. |
cb0118ee73e3
avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents:
1412
diff
changeset
|
1652 |
foundOne := e notNil. |
cb0118ee73e3
avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents:
1412
diff
changeset
|
1653 |
] |
cb0118ee73e3
avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents:
1412
diff
changeset
|
1654 |
] |
244 | 1655 |
]. |
1656 |
^ e |
|
476 | 1657 |
|
1492
cb0118ee73e3
avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents:
1412
diff
changeset
|
1658 |
"Modified: 27.3.1997 / 16:17:38 / cg" |
244 | 1659 |
! |
1660 |
||
703
4324ab5e3630
added facility to lock expose event queue (temporary kludge ?)
Claus Gittinger <cg@exept.de>
parents:
612
diff
changeset
|
1661 |
nextExposeEventFor:aView |
1806
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1791
diff
changeset
|
1662 |
"retrieve the next expose event for aView (or any view if nil). |
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1791
diff
changeset
|
1663 |
Return if there are no expose events. |
703
4324ab5e3630
added facility to lock expose event queue (temporary kludge ?)
Claus Gittinger <cg@exept.de>
parents:
612
diff
changeset
|
1664 |
Remove it from the queue." |
4324ab5e3630
added facility to lock expose event queue (temporary kludge ?)
Claus Gittinger <cg@exept.de>
parents:
612
diff
changeset
|
1665 |
|
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1666 |
damage size == 0 ifTrue:[^ nil]. |
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1667 |
|
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1668 |
" |
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1669 |
be careful: events are inserted at higher prio ... |
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1670 |
" |
1847
f449f3009e88
need even more protection against process-interrupts
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
1671 |
self criticalEventQueueAccess:[ |
1806
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1791
diff
changeset
|
1672 |
damage keysAndValuesDo:[:idx :anEvent | |
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1791
diff
changeset
|
1673 |
anEvent notNil ifTrue:[ |
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1791
diff
changeset
|
1674 |
anEvent isDamage ifTrue:[ |
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1791
diff
changeset
|
1675 |
(aView isNil or:[anEvent view == aView]) ifTrue:[ |
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1791
diff
changeset
|
1676 |
damage at:idx put:nil. |
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1791
diff
changeset
|
1677 |
^ anEvent |
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1791
diff
changeset
|
1678 |
] |
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1791
diff
changeset
|
1679 |
]. |
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1791
diff
changeset
|
1680 |
]. |
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1791
diff
changeset
|
1681 |
] |
703
4324ab5e3630
added facility to lock expose event queue (temporary kludge ?)
Claus Gittinger <cg@exept.de>
parents:
612
diff
changeset
|
1682 |
]. |
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1683 |
|
703
4324ab5e3630
added facility to lock expose event queue (temporary kludge ?)
Claus Gittinger <cg@exept.de>
parents:
612
diff
changeset
|
1684 |
^ nil |
4324ab5e3630
added facility to lock expose event queue (temporary kludge ?)
Claus Gittinger <cg@exept.de>
parents:
612
diff
changeset
|
1685 |
|
4324ab5e3630
added facility to lock expose event queue (temporary kludge ?)
Claus Gittinger <cg@exept.de>
parents:
612
diff
changeset
|
1686 |
"Created: 21.5.1996 / 17:20:54 / cg" |
1851
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1687 |
"Modified: 6.8.1997 / 20:29:37 / cg" |
703
4324ab5e3630
added facility to lock expose event queue (temporary kludge ?)
Claus Gittinger <cg@exept.de>
parents:
612
diff
changeset
|
1688 |
! |
4324ab5e3630
added facility to lock expose event queue (temporary kludge ?)
Claus Gittinger <cg@exept.de>
parents:
612
diff
changeset
|
1689 |
|
140 | 1690 |
pendingEvent |
152 | 1691 |
"retrieve the next pending user (i.e. non-damage) event. |
1692 |
Return nil, if there is none pending. |
|
140 | 1693 |
Do not remove it from the queue." |
47 | 1694 |
|
1063 | 1695 |
|e| |
47 | 1696 |
|
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1697 |
mouseAndKeyboard size == 0 ifTrue:[^ nil]. |
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1698 |
|
47 | 1699 |
[e isNil] whileTrue:[ |
1271 | 1700 |
" |
1701 |
be careful: events are inserted at higher prio ... |
|
1702 |
" |
|
1847
f449f3009e88
need even more protection against process-interrupts
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
1703 |
self criticalEventQueueAccess:[ |
1271 | 1704 |
mouseAndKeyboard size == 0 ifTrue:[^ nil]. |
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1705 |
|
1271 | 1706 |
e := mouseAndKeyboard first. |
1707 |
e isNil ifTrue:[ |
|
1708 |
mouseAndKeyboard removeFirst |
|
1709 |
]. |
|
1710 |
] |
|
0 | 1711 |
]. |
47 | 1712 |
^ e |
476 | 1713 |
|
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1714 |
"Modified: 18.1.1997 / 14:13:04 / cg" |
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1715 |
! |
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1716 |
|
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1717 |
pushDamageEvent:anEvent |
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1718 |
"put an event into the damage queue |
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1719 |
- this is not meant for public use" |
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1720 |
|
1847
f449f3009e88
need even more protection against process-interrupts
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
1721 |
self criticalEventQueueAccess:[ |
1851
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1722 |
damage addLast:anEvent. |
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1723 |
]. |
1851
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1724 |
self notifyEventArrival:anEvent view |
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1725 |
|
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1726 |
"Created: 18.1.1997 / 14:16:45 / cg" |
1851
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1727 |
"Modified: 6.8.1997 / 19:14:24 / cg" |
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1728 |
! |
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1729 |
|
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1730 |
pushEvent:anEvent |
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1731 |
"put an event into the queue - this can also be sent by |
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1732 |
applications and allows simulation of events |
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1733 |
(implementation of recorders & playback) |
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1734 |
or asynchronous communication between view applications |
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1735 |
(by sending arbitrary events, which leads to a message sent, |
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1736 |
when the target windowGroups process is rescheduled)." |
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1737 |
|
1412
c2553d477315
handle #quit event (ST-80 support)
Claus Gittinger <cg@exept.de>
parents:
1359
diff
changeset
|
1738 |
|v| |
c2553d477315
handle #quit event (ST-80 support)
Claus Gittinger <cg@exept.de>
parents:
1359
diff
changeset
|
1739 |
|
c2553d477315
handle #quit event (ST-80 support)
Claus Gittinger <cg@exept.de>
parents:
1359
diff
changeset
|
1740 |
v := anEvent view. |
1847
f449f3009e88
need even more protection against process-interrupts
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
1741 |
self criticalEventQueueAccess:[ |
1412
c2553d477315
handle #quit event (ST-80 support)
Claus Gittinger <cg@exept.de>
parents:
1359
diff
changeset
|
1742 |
mouseAndKeyboard addLast:anEvent. |
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1743 |
]. |
1851
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1744 |
self notifyEventArrival:v |
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1745 |
|
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1746 |
"Created: 18.9.1995 / 22:37:57 / claus" |
1851
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1747 |
"Modified: 6.8.1997 / 19:14:14 / cg" |
0 | 1748 |
! ! |
1749 |
||
244 | 1750 |
!WindowSensor methodsFor:'event simulation'! |
1751 |
||
1752 |
forwardKeyEventsTo:aView |
|
1753 |
"remove all keyboard events and send them to aViews sensor instead" |
|
1754 |
||
1755 |
1 to:mouseAndKeyboard size do:[:i | |
|
1271 | 1756 |
|anEvent| |
244 | 1757 |
|
1271 | 1758 |
anEvent := mouseAndKeyboard at:i. |
1759 |
anEvent notNil ifTrue:[ |
|
1760 |
anEvent isKeyEvent ifTrue:[ |
|
1761 |
anEvent view:aView. |
|
1762 |
aView sensor pushEvent:anEvent. |
|
1763 |
mouseAndKeyboard at:i put:nil |
|
1764 |
] |
|
1765 |
] |
|
244 | 1766 |
]. |
1767 |
||
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1768 |
"Modified: 18.1.1997 / 14:05:02 / cg" |
244 | 1769 |
! |
1770 |
||
1771 |
pushUserEvent:aSelector for:aView |
|
1772 |
"manually put an event into the queue - this allows |
|
1773 |
simulation of events (implementation of recorders & playback) |
|
1774 |
or asynchronous communication between view applications. |
|
1775 |
The view will perform a method as specified by aSelector, |
|
1776 |
when it performs event processing; this is different than sending |
|
1777 |
this message directly, since the execution is done by the views process, |
|
1778 |
not by the current process (which is especially worthwhile, if that method |
|
1779 |
shows a modal box or similar)." |
|
1780 |
||
1781 |
self pushUserEvent:aSelector for:aView withArguments:#() |
|
1782 |
||
1783 |
"Modified: 18.9.1995 / 22:40:12 / claus" |
|
1784 |
! |
|
1785 |
||
1786 |
pushUserEvent:aSelector for:aView withArguments:arguments |
|
1787 |
"manually put an event into the queue - this allows |
|
1788 |
simulation of events (implementation of recorders & playback) |
|
1789 |
or asynchronous communication between view applications. |
|
1790 |
The view will perform a method as specified by aSelector, |
|
1791 |
when it performs event processing; this is different than sending |
|
1792 |
this message directly, since the execution is done by the views process, |
|
1793 |
not by the current process (which is especially worthwhile, if that method |
|
1794 |
shows a modal box or similar)." |
|
1795 |
||
1796 |
self pushEvent:(WindowEvent |
|
1271 | 1797 |
for:aView |
1798 |
type:aSelector |
|
1799 |
arguments:arguments). |
|
244 | 1800 |
|
1801 |
" |
|
1802 |
|b| |
|
1803 |
b := Button label:'test'. |
|
1804 |
b open. |
|
1805 |
(Delay forSeconds:5) wait. |
|
1155
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
1806 |
b sensor pushUserEvent:#pointerEnter:x:y: for:b withArguments:#(0 1 1). |
244 | 1807 |
(Delay forSeconds:1) wait. |
1155
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
1808 |
b sensor pushUserEvent:#buttonPress:x:y: for:b withArguments:#(1 1 1). |
244 | 1809 |
(Delay forSeconds:2) wait. |
1155
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
1810 |
b sensor pushUserEvent:#buttonRelease:x:y: for:b withArguments:#(1 1 1). |
244 | 1811 |
(Delay forSeconds:1) wait. |
1155
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
1812 |
b sensor pushUserEvent:#pointerLeave: for:b withArguments:#(0). |
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
1813 |
" |
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
1814 |
|
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
1815 |
" |
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
1816 |
|b| |
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
1817 |
b := Button label:'test'. |
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
1818 |
b open. |
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
1819 |
(Delay forSeconds:5) wait. |
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
1820 |
b sensor pushUserEvent:#fooBar for:b withArguments:#(). |
244 | 1821 |
" |
1155
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
1822 |
|
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
1823 |
" |
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
1824 |
|b| |
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
1825 |
b := Button label:'test'. |
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
1826 |
b open. |
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
1827 |
(Delay forSeconds:3) wait. |
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
1828 |
b sensor pushUserEvent:#disable for:b withArguments:#(). |
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
1829 |
" |
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
1830 |
|
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
1831 |
"Modified: 4.1.1997 / 13:53:01 / cg" |
244 | 1832 |
! ! |
1833 |
||
1834 |
!WindowSensor methodsFor:'initialization'! |
|
1835 |
||
1836 |
initialize |
|
1837 |
"initialize the event queues to empty" |
|
1838 |
||
1791
d7b59bf5e9da
use new per-process interruptBlock feature
Claus Gittinger <cg@exept.de>
parents:
1790
diff
changeset
|
1839 |
accessLock := Semaphore forMutualExclusion. |
1790
a7f42261ab45
need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents:
1734
diff
changeset
|
1840 |
accessLock name:'WSensor ev-q accessLock'. |
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1841 |
|
244 | 1842 |
damage := OrderedCollection new. |
1843 |
mouseAndKeyboard := OrderedCollection new. |
|
1295
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
1844 |
|
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
1845 |
gotExpose := IdentitySet new. |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
1846 |
catchExpose := IdentitySet new. |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
1847 |
gotOtherEvent := IdentitySet new. |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
1848 |
exposeEventSemaphore := Semaphore new name:'WSensor exposeSema'. |
244 | 1849 |
|
1850 |
compressMotionEvents := translateKeyboardEvents := true. |
|
1851 |
ignoreUserInput := false. |
|
1852 |
shiftDown := ctrlDown := altDown := metaDown := false. |
|
1853 |
leftButtonDown := middleButtonDown := rightButtonDown := false. |
|
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1854 |
|
1791
d7b59bf5e9da
use new per-process interruptBlock feature
Claus Gittinger <cg@exept.de>
parents:
1790
diff
changeset
|
1855 |
"Modified: 28.6.1997 / 16:56:07 / cg" |
244 | 1856 |
! |
1857 |
||
1858 |
reinitialize |
|
1859 |
"called when an image is restarted; |
|
1860 |
reinitialize the event queues to empty; leave other setup as-is" |
|
1861 |
||
1862 |
self flushUserEvents. |
|
1863 |
self flushExposeEvents. |
|
1295
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
1864 |
|
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
1865 |
gotExpose := IdentitySet new. |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
1866 |
catchExpose := IdentitySet new. |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
1867 |
gotOtherEvent := IdentitySet new. |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
1868 |
exposeEventSemaphore := Semaphore new name:'WSensor exposeSema'. |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
1869 |
|
244 | 1870 |
shiftDown := ctrlDown := altDown := metaDown := false. |
1871 |
leftButtonDown := middleButtonDown := rightButtonDown := false. |
|
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1872 |
|
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1873 |
"Modified: 18.1.1997 / 15:30:23 / cg" |
244 | 1874 |
! ! |
1875 |
||
1100 | 1876 |
!WindowSensor methodsFor:'queries - event queue'! |
1877 |
||
1878 |
eventPending |
|
1879 |
"return true, if either damage or events are pending" |
|
1880 |
||
1881 |
mouseAndKeyboard size ~~ 0 ifTrue:[^ true]. |
|
1882 |
^ damage size ~~ 0 |
|
1883 |
! |
|
1884 |
||
1885 |
hasButtonEventFor:aView |
|
1886 |
"return true, if any button events are pending. |
|
1887 |
If the argument, aView is nil, the information is regarding any |
|
1888 |
view (i.e. is there a button event for any of my views); |
|
1505 | 1889 |
otherwise, the information is regarding that specific view." |
1100 | 1890 |
|
1891 |
(self hasButtonMotionEventFor:aView) ifTrue:[^ true]. |
|
1892 |
(self hasButtonPressEventFor:aView) ifTrue:[^ true]. |
|
1893 |
^ (self hasButtonReleaseEventFor:aView) |
|
1894 |
||
1895 |
"Created: 1.11.1996 / 17:02:23 / cg" |
|
1896 |
"Modified: 1.11.1996 / 17:12:03 / cg" |
|
1897 |
! |
|
1898 |
||
1899 |
hasButtonMotionEventFor:aView |
|
1900 |
"return true, if any buttonMotion events are pending. |
|
1901 |
If the argument, aView is nil, the information is regarding any |
|
1902 |
view (i.e. is there a motion event for any of my views); |
|
1505 | 1903 |
otherwise, the information is regarding that specific view." |
1100 | 1904 |
|
1905 |
^ self hasEvent:#buttonMotion:x:y: orPendingDeviceEvent:#buttonMotion for:aView |
|
1906 |
||
1907 |
"Created: 1.11.1996 / 17:04:01 / cg" |
|
1908 |
! |
|
1909 |
||
1910 |
hasButtonPressEventFor:aView |
|
1911 |
"return true, if any buttonPress events are pending. |
|
1912 |
If the argument, aView is nil, the information is regarding any |
|
1913 |
view (i.e. is there a buttonPress event for any of my views); |
|
1505 | 1914 |
otherwise, the information is regarding that specific view." |
1100 | 1915 |
|
1916 |
^ self hasEvent:#buttonPress:x:y: orPendingDeviceEvent:#buttonPress for:aView |
|
1917 |
||
1918 |
"Created: 1.11.1996 / 17:05:10 / cg" |
|
1919 |
"Modified: 1.11.1996 / 17:11:09 / cg" |
|
1920 |
! |
|
1921 |
||
1922 |
hasButtonReleaseEventFor:aView |
|
1923 |
"return true, if any buttonRelease events are pending. |
|
1924 |
If the argument, aView is nil, the information is regarding any |
|
1925 |
view (i.e. is there a buttonrelease event for any of my views); |
|
1505 | 1926 |
otherwise, the information is regarding that specific view." |
1100 | 1927 |
|
1928 |
^ self hasEvent:#buttonRelease:x:y: orPendingDeviceEvent:#buttonRelease for:aView |
|
1929 |
||
1930 |
"Created: 1.11.1996 / 17:05:26 / cg" |
|
1931 |
"Modified: 1.11.1996 / 17:11:18 / cg" |
|
1932 |
! |
|
1933 |
||
1934 |
hasConfigureEventFor:aView |
|
1935 |
"return true, if any resize/position events are pending. |
|
1936 |
If the argument, aView is nil, the information is regarding any |
|
1937 |
view (i.e. is there a configure event for any of my views); |
|
1505 | 1938 |
otherwise, the information is regarding that specific view." |
1100 | 1939 |
|
1940 |
^ self hasEvent:#configureX:y:width:height: orPendingDeviceEvent:#structureNotify for:aView |
|
1941 |
||
1942 |
"Modified: 1.11.1996 / 17:11:27 / cg" |
|
1943 |
! |
|
1944 |
||
1945 |
hasDamage |
|
1512 | 1946 |
"return true, if any damage events (i.e. expose or resize) are pending. |
1947 |
Since this is often invoked by ST-80 classes to poll the sensor, |
|
1948 |
a yield is done here to avoid a busy wait blocking other processes." |
|
1949 |
||
1950 |
Processor yield. |
|
1100 | 1951 |
^ damage size ~~ 0 |
1952 |
||
1512 | 1953 |
"Modified: 2.4.1997 / 14:14:01 / cg" |
1100 | 1954 |
! |
1955 |
||
1956 |
hasDamageFor:aView |
|
1957 |
"return true, if any damage events (i.e. expose or resize) |
|
1958 |
are pending for aView" |
|
1959 |
||
1960 |
damage size ~~ 0 ifTrue:[ |
|
1271 | 1961 |
damage do:[:aDamage | |
1962 |
aDamage notNil ifTrue:[ |
|
1963 |
aDamage view == aView ifTrue:[^ true]. |
|
1964 |
]. |
|
1965 |
] |
|
1100 | 1966 |
]. |
1967 |
^ false |
|
1968 |
||
1969 |
"Modified: 21.5.1996 / 17:15:09 / cg" |
|
1970 |
! |
|
1971 |
||
1155
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
1972 |
hasEvent:type for:aView withArguments:args |
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
1973 |
"return true, if a specific event is pending in my queues. |
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
1974 |
Type is the type of event, args are the arguments. |
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
1975 |
If the argument, aView is nil, the information is regarding any |
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
1976 |
view (i.e. is there an event for any of my views); |
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
1977 |
otherwise, the information is regarding to that specific view." |
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
1978 |
|
1505 | 1979 |
^ self |
1980 |
hasEvent:type |
|
1981 |
for:aView |
|
1982 |
withMatchingArguments:[:evArgs | evArgs = args] |
|
1983 |
! |
|
1984 |
||
1985 |
hasEvent:type for:aView withMatchingArguments:argMatchBlock |
|
1986 |
"return true, if a matching event is pending in my queues. |
|
1987 |
Type is the type of event, matchBlock is a block which gets the event args |
|
1988 |
and should return true. |
|
1989 |
If the argument, aView is nil, the information is regarding any |
|
1990 |
view (i.e. is there an event for any of my views); |
|
1991 |
otherwise, the information is regarding to that specific view." |
|
1992 |
||
1155
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
1993 |
mouseAndKeyboard size ~~ 0 ifTrue:[ |
1505 | 1994 |
mouseAndKeyboard do:[:anEvent | |
1995 |
anEvent notNil ifTrue:[ |
|
1996 |
(aView isNil or:[anEvent view == aView]) ifTrue:[ |
|
1997 |
anEvent type == type ifTrue:[ |
|
1998 |
(argMatchBlock value:anEvent arguments) ifTrue:[ |
|
1999 |
^ true |
|
2000 |
]. |
|
2001 |
] |
|
2002 |
] |
|
2003 |
]. |
|
2004 |
] |
|
1155
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
2005 |
]. |
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
2006 |
damage size ~~ 0 ifTrue:[ |
1505 | 2007 |
damage do:[:anEvent | |
2008 |
anEvent notNil ifTrue:[ |
|
2009 |
(aView isNil or:[anEvent view == aView]) ifTrue:[ |
|
2010 |
anEvent type == type ifTrue:[ |
|
2011 |
(argMatchBlock value:anEvent arguments) ifTrue:[ |
|
2012 |
^ true |
|
2013 |
] |
|
2014 |
]. |
|
2015 |
] |
|
2016 |
]. |
|
2017 |
] |
|
1155
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
2018 |
]. |
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
2019 |
^ false |
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
2020 |
|
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
2021 |
"Modified: 1.11.1996 / 17:11:47 / cg" |
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
2022 |
"Created: 4.1.1997 / 14:00:29 / cg" |
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
2023 |
! |
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
2024 |
|
1100 | 2025 |
hasEvent:type orPendingDeviceEvent:dType for:aView |
2026 |
"return true, if a specific event is pending. |
|
2027 |
Type is the type of event, dType the corresponding device event. |
|
2028 |
If the argument, aView is nil, the information is regarding any |
|
2029 |
view (i.e. is there an event for any of my views); |
|
2030 |
otherwise, the information is regarding to that specific view." |
|
2031 |
||
2032 |
mouseAndKeyboard size ~~ 0 ifTrue:[ |
|
1271 | 2033 |
mouseAndKeyboard do:[:anEvent | |
2034 |
anEvent notNil ifTrue:[ |
|
2035 |
(aView isNil or:[anEvent view == aView]) ifTrue:[ |
|
2036 |
anEvent type == type ifTrue:[^ true]. |
|
2037 |
] |
|
2038 |
]. |
|
2039 |
] |
|
1100 | 2040 |
]. |
2041 |
damage size ~~ 0 ifTrue:[ |
|
1271 | 2042 |
damage do:[:anEvent | |
2043 |
anEvent notNil ifTrue:[ |
|
2044 |
(aView isNil or:[anEvent view == aView]) ifTrue:[ |
|
2045 |
anEvent type == type ifTrue:[^ true]. |
|
2046 |
] |
|
2047 |
]. |
|
2048 |
] |
|
1100 | 2049 |
]. |
2050 |
aView notNil ifTrue:[ |
|
1271 | 2051 |
^ aView graphicsDevice eventPending:dType for:aView id |
1100 | 2052 |
]. |
2053 |
^ false |
|
2054 |
||
2055 |
"Modified: 1.11.1996 / 17:11:47 / cg" |
|
2056 |
! |
|
2057 |
||
2058 |
hasEvents |
|
2059 |
"return true, if any mouse/keyboard events are pending" |
|
2060 |
||
2061 |
^ mouseAndKeyboard size ~~ 0 |
|
2062 |
! |
|
2063 |
||
2064 |
hasExposeEventFor:aView |
|
2065 |
"return true, if any exposure events are pending for aView" |
|
2066 |
||
2067 |
damage size ~~ 0 ifTrue:[ |
|
1271 | 2068 |
damage do:[:aDamage | |
2069 |
aDamage notNil ifTrue:[ |
|
2070 |
aDamage isDamage ifTrue:[ |
|
2071 |
(aView isNil |
|
2072 |
or:[aDamage view == aView]) ifTrue:[^ true]. |
|
2073 |
] |
|
2074 |
]. |
|
2075 |
] |
|
1100 | 2076 |
]. |
2077 |
^ false |
|
2078 |
||
2079 |
"Modified: 21.5.1996 / 17:13:09 / cg" |
|
2080 |
"Created: 1.11.1996 / 17:05:41 / cg" |
|
2081 |
! |
|
2082 |
||
2083 |
hasKeyEventFor:aView |
|
2084 |
"return true, if any key (press or release) events are pending. |
|
2085 |
If the argument, aView is nil, the information is regarding any |
|
2086 |
view (i.e. is there a key event for any of my views); |
|
1505 | 2087 |
otherwise, the information is regarding that specific view." |
1100 | 2088 |
|
2089 |
(self hasKeyPressEventFor:aView) ifTrue:[^ true]. |
|
2090 |
^ self hasKeyReleaseEventFor:aView |
|
2091 |
||
2092 |
"Created: 1.11.1996 / 17:08:03 / cg" |
|
2093 |
"Modified: 1.11.1996 / 17:11:55 / cg" |
|
2094 |
! |
|
2095 |
||
2096 |
hasKeyPressEventFor:aView |
|
2097 |
"return true, if any keyPress events are pending. |
|
2098 |
If the argument, aView is nil, the information is regarding any |
|
2099 |
view (i.e. is there a keyPress event for any of my views); |
|
1505 | 2100 |
otherwise, the information is regarding that specific view." |
1100 | 2101 |
|
2102 |
^ self hasEvent:#keyPress:x:y: orPendingDeviceEvent:#keyPress for:aView |
|
2103 |
||
2104 |
"Created: 1.11.1996 / 17:05:58 / cg" |
|
2105 |
"Modified: 1.11.1996 / 17:12:10 / cg" |
|
2106 |
! |
|
2107 |
||
2108 |
hasKeyReleaseEventFor:aView |
|
2109 |
"return true, if any keyRelease events are pending. |
|
2110 |
If the argument, aView is nil, the information is regarding any |
|
2111 |
view (i.e. is there a keyRelease event for any of my views); |
|
1505 | 2112 |
otherwise, the information is regarding that specific view." |
1100 | 2113 |
|
2114 |
^ self hasEvent:#keyRelease:x:y: orPendingDeviceEvent:#keyRelease for:aView |
|
2115 |
||
2116 |
"Created: 1.11.1996 / 17:06:34 / cg" |
|
2117 |
"Modified: 1.11.1996 / 17:12:15 / cg" |
|
2118 |
! |
|
2119 |
||
2120 |
hasUserEventFor:aView |
|
2121 |
"return true, if any user event (i.e. key or button events) are pending. |
|
2122 |
If the argument, aView is nil, the information is regarding any |
|
2123 |
view (i.e. is there a user event for any of my views); |
|
1505 | 2124 |
otherwise, the information is regarding that specific view." |
1100 | 2125 |
|
2126 |
(self hasKeyEventFor:aView) ifTrue:[^ true]. |
|
2127 |
^ (self hasButtonEventFor:aView) |
|
2128 |
||
2129 |
"Created: 1.11.1996 / 17:08:50 / cg" |
|
2130 |
"Modified: 1.11.1996 / 17:12:21 / cg" |
|
2131 |
! |
|
2132 |
||
2133 |
motionEventPending |
|
2134 |
"return true, if any buttonMotion events are pending." |
|
2135 |
||
2136 |
^ self hasButtonMotionEventFor:nil |
|
2137 |
||
2138 |
"Created: 24.3.1996 / 20:09:55 / cg" |
|
2139 |
"Modified: 1.11.1996 / 17:04:43 / cg" |
|
2140 |
! ! |
|
2141 |
||
2142 |
!WindowSensor methodsFor:'queries - key & button state'! |
|
140 | 2143 |
|
244 | 2144 |
altDown |
2145 |
"return true, if the meta key is currently pressed. |
|
2146 |
Notice, that some keyboards dont have an alt key; |
|
2147 |
it is better to use 'sensor metaDown or:[sensor altDown]'." |
|
2148 |
||
2149 |
^ altDown |
|
2150 |
! |
|
2151 |
||
2152 |
anyButtonPressed |
|
2153 |
"ST-80 compatibility: return true, if any mouse button is pressed. |
|
2154 |
You should no use it in 'normal' applications. |
|
2155 |
Instead, keep track of the buttons state in your views or controllers |
|
2156 |
button-event methods." |
|
2157 |
||
1083
6e947cc67324
fixed #anyButtonPressed & setting of buttonDown-flags
Claus Gittinger <cg@exept.de>
parents:
1082
diff
changeset
|
2158 |
^ leftButtonDown or:[middleButtonDown or:[rightButtonDown]] |
6e947cc67324
fixed #anyButtonPressed & setting of buttonDown-flags
Claus Gittinger <cg@exept.de>
parents:
1082
diff
changeset
|
2159 |
|
6e947cc67324
fixed #anyButtonPressed & setting of buttonDown-flags
Claus Gittinger <cg@exept.de>
parents:
1082
diff
changeset
|
2160 |
"Modified: 21.10.1996 / 11:37:31 / cg" |
244 | 2161 |
! |
2162 |
||
2163 |
blueButtonPressed |
|
2164 |
"ST-80 compatibility: return true, if the right mouse button is pressed. |
|
2165 |
You should no use it in 'normal' applications. |
|
2166 |
Instead, keep track of the buttons state in your views or controllers |
|
2167 |
button-event methods." |
|
2168 |
||
2169 |
^ rightButtonDown |
|
2170 |
! |
|
2171 |
||
2172 |
ctrlDown |
|
2173 |
"return true, if any CTRL key is currently pressed." |
|
2174 |
||
2175 |
^ ctrlDown |
|
2176 |
! |
|
2177 |
||
157 | 2178 |
leftButtonPressed |
2179 |
"return true, if the left mouse button is pressed. |
|
2180 |
This has been added to support ST-80 style button polling; |
|
2181 |
however, you should no use it in 'normal' applications. |
|
2182 |
Instead, keep track of the buttons state in your views or controllers |
|
2183 |
button-event methods." |
|
2184 |
||
2185 |
^ leftButtonDown |
|
2186 |
! |
|
2187 |
||
244 | 2188 |
metaDown |
2189 |
"return true, if the meta key is currently pressed. |
|
2190 |
Notice, that most keyboards dont have a meta key; |
|
2191 |
it is better to use 'sensor metaDown or:[sensor altDown]'." |
|
2192 |
||
2193 |
^ metaDown |
|
2194 |
! |
|
2195 |
||
157 | 2196 |
middleButtonPressed |
2197 |
"return true, if the middle mouse button is pressed. |
|
2198 |
This has been added to support ST-80 style button polling; |
|
2199 |
however, you should no use it in 'normal' applications. |
|
2200 |
Instead, keep track of the buttons state in your views or controllers |
|
2201 |
button-event methods." |
|
2202 |
||
2203 |
^ middleButtonDown |
|
2204 |
! |
|
2205 |
||
244 | 2206 |
redButtonPressed |
2207 |
"ST-80 compatibility: return true, if the left mouse button is pressed. |
|
2208 |
You should no use it in 'normal' applications. |
|
2209 |
Instead, keep track of the buttons state in your views or controllers |
|
2210 |
button-event methods." |
|
2211 |
||
2212 |
^ leftButtonDown |
|
2213 |
! |
|
2214 |
||
157 | 2215 |
rightButtonPressed |
2216 |
"return true, if the right mouse button is pressed. |
|
2217 |
This has been added to support ST-80 style button polling; |
|
2218 |
however, you should no use it in 'normal' applications. |
|
2219 |
Instead, keep track of the buttons state in your views or controllers |
|
2220 |
button-event methods." |
|
2221 |
||
2222 |
^ rightButtonDown |
|
2223 |
! |
|
2224 |
||
244 | 2225 |
shiftDown |
2226 |
"return true, if any shift key is currently pressed." |
|
157 | 2227 |
|
244 | 2228 |
^ shiftDown |
157 | 2229 |
! |
2230 |
||
2231 |
yellowButtonPressed |
|
2232 |
"ST-80 compatibility: return true, if the middle mouse button is pressed. |
|
2233 |
You should no use it in 'normal' applications. |
|
2234 |
Instead, keep track of the buttons state in your views or controllers |
|
2235 |
button-event methods." |
|
2236 |
||
2237 |
^ middleButtonDown |
|
140 | 2238 |
! ! |
2239 |
||
1100 | 2240 |
!WindowSensor methodsFor:'queries - pointer'! |
2241 |
||
2242 |
cursorPoint |
|
2243 |
"ST-80 compatibility: |
|
2244 |
return the position of the mouse pointer on the current display |
|
2245 |
(in screen coordinates)" |
|
2246 |
||
2247 |
^ self class cursorPoint |
|
2248 |
! |
|
2249 |
||
2250 |
globalOrigin |
|
2251 |
"ST-80 compatibility: |
|
2252 |
dont know what we should return here ... |
|
2253 |
... at least the PD program which uses it works when we return 0@0." |
|
2254 |
||
2255 |
^ 0@0 |
|
2256 |
! |
|
2257 |
||
2258 |
mousePoint |
|
2259 |
"ST-80 compatibility: |
|
2260 |
return the position of the mouse pointer on the current display |
|
2261 |
(in screen coordinates)" |
|
2262 |
||
2263 |
^ self cursorPoint |
|
2264 |
! ! |
|
2265 |
||
26 | 2266 |
!WindowSensor methodsFor:'special'! |
2267 |
||
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
2268 |
catchExposeFor:aView |
54 | 2269 |
"start catching noExpose events (must be done BEFORE a bitblt, |
2270 |
to prepare for the exposeEventSemaphore to be signalled when |
|
2271 |
the noExpose event arrives)." |
|
26 | 2272 |
|
1295
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
2273 |
"/ this is only needed for X ... |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
2274 |
aView device scrollsAsynchronous ifFalse:[ |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
2275 |
^ self |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
2276 |
]. |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
2277 |
|
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
2278 |
(catchExpose includes:aView) ifTrue:[ |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
2279 |
('WSensor [warning]: already catching (for ' , aView printString , ')') errorPrintCR. |
1274 | 2280 |
Delay waitForMilliseconds:100. |
1295
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
2281 |
(catchExpose includes:aView) ifTrue:[ |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
2282 |
('WSensor [warning]: still catching (for ' , aView printString , ')') errorPrintCR. |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
2283 |
"/ wake the other one |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
2284 |
gotExpose add:aView. |
1274 | 2285 |
exposeEventSemaphore signalForAll. |
1295
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
2286 |
Delay waitForMilliseconds:100. |
1274 | 2287 |
]. |
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
2288 |
]. |
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
2289 |
|
1295
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
2290 |
[ |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
2291 |
gotOtherEvent remove:aView ifAbsent:nil. |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
2292 |
gotExpose remove:aView ifAbsent:nil. |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
2293 |
catchExpose add:aView. |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
2294 |
] valueUninterruptably. |
28 | 2295 |
! |
2296 |
||
1320 | 2297 |
pollForActivity |
1529 | 2298 |
"ST-80 compatibility: wait for some activity (i.e. poll for an event) " |
1320 | 2299 |
|
2300 |
"/ should add a buttonStateChangeSemaphore and wait on this ... |
|
1529 | 2301 |
"/ Delay waitForSeconds:0.01. |
2302 |
Processor yield. |
|
2303 |
||
2304 |
"Modified: 12.2.1997 / 12:46:09 / cg" |
|
1320 | 2305 |
! |
2306 |
||
244 | 2307 |
waitButton |
2308 |
"ST-80 compatibility: wait until any mouse button is pressed. |
|
2309 |
Do not use this in your applications; polling the sensor is |
|
2310 |
bad style." |
|
2311 |
||
2312 |
[self anyButtonPressed] whileFalse:[ |
|
1320 | 2313 |
self pollForActivity |
244 | 2314 |
]. |
2315 |
||
1320 | 2316 |
"Modified: 10.2.1997 / 13:30:38 / cg" |
2317 |
! |
|
2318 |
||
2319 |
waitClickButton |
|
2320 |
"ST-80 compatibility: wait until any mouse button is pressed & released again. |
|
2321 |
Do not use this in your applications; polling the sensor is |
|
2322 |
bad style." |
|
2323 |
||
1790
a7f42261ab45
need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents:
1734
diff
changeset
|
2324 |
self waitButton. |
1320 | 2325 |
^self waitNoButton |
2326 |
||
2327 |
"Created: 10.2.1997 / 13:31:09 / cg" |
|
244 | 2328 |
! |
2329 |
||
26 | 2330 |
waitForExposeFor:aView |
157 | 2331 |
"wait until a graphicsExpose or a noExpose arrives (after a bitblt). |
2332 |
This may be too X-specific, and things may change in this area |
|
2333 |
in future versions. (or the new device may simulate the arrival of |
|
2334 |
such an event)" |
|
54 | 2335 |
|
1873
a67649816bc8
break non-windowGroup expose-poll loop after a while (10 seconds)
Claus Gittinger <cg@exept.de>
parents:
1864
diff
changeset
|
2336 |
|blocked lostExpose device stopPoll endPollTime| |
a67649816bc8
break non-windowGroup expose-poll loop after a while (10 seconds)
Claus Gittinger <cg@exept.de>
parents:
1864
diff
changeset
|
2337 |
|
a67649816bc8
break non-windowGroup expose-poll loop after a while (10 seconds)
Claus Gittinger <cg@exept.de>
parents:
1864
diff
changeset
|
2338 |
device := aView graphicsDevice. |
1359
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2339 |
|
1295
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
2340 |
"/ this is only needed for X ... |
1873
a67649816bc8
break non-windowGroup expose-poll loop after a while (10 seconds)
Claus Gittinger <cg@exept.de>
parents:
1864
diff
changeset
|
2341 |
device scrollsAsynchronous ifFalse:[ |
a67649816bc8
break non-windowGroup expose-poll loop after a while (10 seconds)
Claus Gittinger <cg@exept.de>
parents:
1864
diff
changeset
|
2342 |
gotExpose remove:aView ifAbsent:nil. |
a67649816bc8
break non-windowGroup expose-poll loop after a while (10 seconds)
Claus Gittinger <cg@exept.de>
parents:
1864
diff
changeset
|
2343 |
catchExpose remove:aView ifAbsent:nil. |
1359
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2344 |
^ self |
1027
0ba82862ca8d
fixes for synchronous scrolling (WINDOWS)
Claus Gittinger <cg@exept.de>
parents:
1013
diff
changeset
|
2345 |
]. |
0ba82862ca8d
fixes for synchronous scrolling (WINDOWS)
Claus Gittinger <cg@exept.de>
parents:
1013
diff
changeset
|
2346 |
|
1359
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2347 |
blocked := true. |
1013
32d804ff472d
cleanup when unwinding from a waitForExpose
Claus Gittinger <cg@exept.de>
parents:
1012
diff
changeset
|
2348 |
[ |
1359
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2349 |
aView flush. |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2350 |
Processor activeProcessIsSystemProcess ifTrue:[ |
1873
a67649816bc8
break non-windowGroup expose-poll loop after a while (10 seconds)
Claus Gittinger <cg@exept.de>
parents:
1864
diff
changeset
|
2351 |
endPollTime := AbsoluteTime now addSeconds:10. |
a67649816bc8
break non-windowGroup expose-poll loop after a while (10 seconds)
Claus Gittinger <cg@exept.de>
parents:
1864
diff
changeset
|
2352 |
stopPoll := false. |
a67649816bc8
break non-windowGroup expose-poll loop after a while (10 seconds)
Claus Gittinger <cg@exept.de>
parents:
1864
diff
changeset
|
2353 |
|
a67649816bc8
break non-windowGroup expose-poll loop after a while (10 seconds)
Claus Gittinger <cg@exept.de>
parents:
1864
diff
changeset
|
2354 |
"/ |
a67649816bc8
break non-windowGroup expose-poll loop after a while (10 seconds)
Claus Gittinger <cg@exept.de>
parents:
1864
diff
changeset
|
2355 |
"/ cannot really suspend, if its a systemProcess |
a67649816bc8
break non-windowGroup expose-poll loop after a while (10 seconds)
Claus Gittinger <cg@exept.de>
parents:
1864
diff
changeset
|
2356 |
"/ must poll for the event |
a67649816bc8
break non-windowGroup expose-poll loop after a while (10 seconds)
Claus Gittinger <cg@exept.de>
parents:
1864
diff
changeset
|
2357 |
"/ |
a67649816bc8
break non-windowGroup expose-poll loop after a while (10 seconds)
Claus Gittinger <cg@exept.de>
parents:
1864
diff
changeset
|
2358 |
[(gotExpose includes:aView) or:[stopPoll]] whileFalse:[ |
a67649816bc8
break non-windowGroup expose-poll loop after a while (10 seconds)
Claus Gittinger <cg@exept.de>
parents:
1864
diff
changeset
|
2359 |
(device exposeEventPendingFor:aView id withSync:true) ifTrue:[ |
a67649816bc8
break non-windowGroup expose-poll loop after a while (10 seconds)
Claus Gittinger <cg@exept.de>
parents:
1864
diff
changeset
|
2360 |
device dispatchExposeEventFor:aView id. |
a67649816bc8
break non-windowGroup expose-poll loop after a while (10 seconds)
Claus Gittinger <cg@exept.de>
parents:
1864
diff
changeset
|
2361 |
]. |
a67649816bc8
break non-windowGroup expose-poll loop after a while (10 seconds)
Claus Gittinger <cg@exept.de>
parents:
1864
diff
changeset
|
2362 |
stopPoll := (AbsoluteTime now > endPollTime). |
1359
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2363 |
Processor yield. |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2364 |
] |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2365 |
] ifFalse:[ |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2366 |
lostExpose := 1. |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2367 |
" |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2368 |
block interrupt here, to resolve race between |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2369 |
testing gotExpose and the semaphore, which is woken up |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2370 |
with #signalForAll. |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2371 |
" |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2372 |
blocked := OperatingSystem blockInterrupts. |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2373 |
[ (gotExpose includes:aView) or:[lostExpose > 2] ] whileFalse:[ |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2374 |
" |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2375 |
just in case we have a (network or software) problem ... |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2376 |
explanation: it may happen, that an expose event is totally |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2377 |
lost - for example, if the network breaks down. |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2378 |
To not block forever, we wait with a timeout, to get out of here |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2379 |
if the event does not arrive after 15 seconds. |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2380 |
" |
1505 | 2381 |
(exposeEventSemaphore waitWithTimeout:(1 * lostExpose)) isNil ifTrue:[ |
1873
a67649816bc8
break non-windowGroup expose-poll loop after a while (10 seconds)
Claus Gittinger <cg@exept.de>
parents:
1864
diff
changeset
|
2382 |
device flush. "/ we are paranoid |
1359
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2383 |
lostExpose == 1 ifTrue:[ |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2384 |
" |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2385 |
you can put a comment around the following line, |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2386 |
if you don't like the message ... |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2387 |
" |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2388 |
('WindowSensor [info]: late expose event (' , aView printString , ')') infoPrintCR. |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2389 |
] ifFalse:[ |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2390 |
'WindowSensor [warning]: lost expose event' errorPrintCR. |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2391 |
]. |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2392 |
lostExpose := lostExpose + 1. |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2393 |
]. |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2394 |
]. |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2395 |
]. |
1013
32d804ff472d
cleanup when unwinding from a waitForExpose
Claus Gittinger <cg@exept.de>
parents:
1012
diff
changeset
|
2396 |
] valueNowOrOnUnwindDo:[ |
1359
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2397 |
gotExpose remove:aView ifAbsent:nil. |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2398 |
catchExpose remove:aView ifAbsent:nil. |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2399 |
blocked ifFalse:[ |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2400 |
OperatingSystem unblockInterrupts. |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2401 |
]. |
1295
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
2402 |
|
1359
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2403 |
"/ |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2404 |
"/ other incoming events have been ignored during the wait. |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2405 |
"/ Now handle those ... |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2406 |
"/ |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2407 |
(gotOtherEvent includes:aView) ifTrue:[ |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2408 |
gotOtherEvent remove:aView ifAbsent:nil. |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2409 |
]. |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2410 |
eventSemaphore signalOnce |
1013
32d804ff472d
cleanup when unwinding from a waitForExpose
Claus Gittinger <cg@exept.de>
parents:
1012
diff
changeset
|
2411 |
]. |
26 | 2412 |
|
1359
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2413 |
"Modified: 20.2.1997 / 09:24:31 / stefan" |
1873
a67649816bc8
break non-windowGroup expose-poll loop after a while (10 seconds)
Claus Gittinger <cg@exept.de>
parents:
1864
diff
changeset
|
2414 |
"Modified: 19.8.1997 / 17:36:20 / cg" |
47 | 2415 |
! |
2416 |
||
157 | 2417 |
waitNoButton |
2418 |
"ST-80 compatibility: wait until no mouse button is pressed. |
|
2419 |
Do not use this in your applications; polling the sensor is |
|
2420 |
bad style." |
|
2421 |
||
2422 |
[self anyButtonPressed] whileTrue:[ |
|
1320 | 2423 |
self pollForActivity |
157 | 2424 |
]. |
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
2425 |
|
1320 | 2426 |
"Modified: 10.2.1997 / 13:30:43 / cg" |
157 | 2427 |
! ! |
2428 |
||
1082 | 2429 |
!WindowSensor class methodsFor:'documentation'! |
251 | 2430 |
|
2431 |
version |
|
2072
a9770eb53908
reenabled flushing of expose events before map/unmap event.
Claus Gittinger <cg@exept.de>
parents:
2058
diff
changeset
|
2432 |
^ '$Header: /cvs/stx/stx/libview/WindowSensor.st,v 1.118 1998-02-27 14:22:26 cg Exp $' |
251 | 2433 |
! ! |
140 | 2434 |
WindowSensor initialize! |