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