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