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