author | Claus Gittinger <cg@exept.de> |
Mon, 08 Feb 1999 15:24:17 +0100 | |
changeset 2441 | 6925d83b717e |
parent 2439 | 358644786358 |
child 2469 | faf22c6b0746 |
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 |
|
2391 | 514 |
|wasBlocked p| |
515 |
||
516 |
p := Processor activeProcess. |
|
517 |
wasBlocked := p blockInterrupts. |
|
2137
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
518 |
[ |
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
519 |
damageEventAccessLock critical:aBlock |
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
520 |
] valueNowOrOnUnwindDo:[ |
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
521 |
wasBlocked ifFalse:[ |
2391 | 522 |
p unblockInterrupts. |
2137
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 |
|
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
526 |
"Created: / 6.6.1998 / 21:04:02 / cg" |
2391 | 527 |
"Modified: / 14.10.1998 / 17:17:05 / cg" |
2137
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 |
|
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
530 |
criticalUserEventQueueAccess:aBlock |
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
531 |
"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
|
532 |
access to the user event queue. |
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
533 |
(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
|
534 |
|
2391 | 535 |
|wasBlocked p| |
536 |
||
537 |
p := Processor activeProcess. |
|
538 |
wasBlocked := p blockInterrupts. |
|
2137
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
539 |
[ |
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
540 |
userEventAccessLock critical:aBlock |
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
541 |
] valueNowOrOnUnwindDo:[ |
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
542 |
wasBlocked ifFalse:[ |
2391 | 543 |
p unblockInterrupts. |
2137
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 |
] |
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
546 |
|
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
547 |
"Created: / 6.6.1998 / 21:06:43 / cg" |
2391 | 548 |
"Modified: / 14.10.1998 / 15:56:08 / cg" |
2137
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
549 |
! |
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
550 |
|
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
551 |
damageEventAccessLock |
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
552 |
"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
|
553 |
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
|
554 |
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
|
555 |
|
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
556 |
^ damageEventAccessLock |
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
557 |
|
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
558 |
"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
|
559 |
"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
|
560 |
! |
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
561 |
|
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
562 |
userEventAccessLock |
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
563 |
"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
|
564 |
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
|
565 |
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
|
566 |
|
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
567 |
^ userEventAccessLock |
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
568 |
|
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
569 |
"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
|
570 |
"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
|
571 |
! ! |
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
572 |
|
244 | 573 |
!WindowSensor methodsFor:'event flushing'! |
144 | 574 |
|
244 | 575 |
compressKeyPressEventsWithKey:aKey |
576 |
"count and remove multiple pending keyPress events for the |
|
577 |
same key, aKey. This is currently used in TextViews to compress |
|
578 |
multiple cursorUp/cursorDown events and do the scroll in one |
|
579 |
operation. (to avoid run-after-cursor on slow displays)" |
|
580 |
||
2022 | 581 |
|n ev evKey| |
244 | 582 |
|
583 |
n := 0. |
|
584 |
ev := self pendingEvent. |
|
2022 | 585 |
|
586 |
[ev notNil and:[ev isKeyEvent]] whileTrue:[ |
|
587 |
evKey := ev arguments at:1. |
|
588 |
(evKey == aKey) ifTrue:[ |
|
2437
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
589 |
ev isKeyReleaseEvent ifFalse:[ |
2022 | 590 |
n := n + 1. |
2437
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
591 |
]. |
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
592 |
self nextEvent. |
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
593 |
ev := self pendingEvent. |
2022 | 594 |
] ifFalse:[ |
595 |
ev := nil |
|
596 |
] |
|
144 | 597 |
]. |
244 | 598 |
^ n |
2022 | 599 |
|
600 |
"Modified: / 27.1.1998 / 14:15:00 / cg" |
|
244 | 601 |
! |
602 |
||
603 |
flushEventsFor:aView |
|
604 |
"throw away all events for aView, |
|
605 |
or any view, if the argument is nil." |
|
606 |
||
607 |
self flushExposeEventsFor:aView. |
|
608 |
self flushUserEventsFor:aView. |
|
609 |
! |
|
610 |
||
2137
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
611 |
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
|
612 |
"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
|
613 |
for which aCondition returns true. |
a7f42261ab45
need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents:
1734
diff
changeset
|
614 |
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
|
615 |
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
|
616 |
|
2137
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
617 |
|action| |
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
618 |
|
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
619 |
action := [ |
2437
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
620 |
|nEvent "{ Class: SmallInteger }" |
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
621 |
anEvent |
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
622 |
queue| |
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
623 |
|
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
624 |
queue := anEventQueue. |
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
625 |
nEvent := queue size. |
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
626 |
1 to:nEvent do:[:index | |
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
627 |
anEvent := queue at:index. |
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
628 |
anEvent notNil ifTrue:[ |
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
629 |
(aView isNil or:[anEvent view == aView]) ifTrue:[ |
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
630 |
(aCondition value:anEvent) ifTrue:[ |
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
631 |
queue at:index put:nil |
1790
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, |
|
2177 | 650 |
(or any view, if the argument is nil) which have a particular type." |
2163 | 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" |
|
2177 | 656 |
"Modified: / 21.7.1998 / 18:16:11 / cg" |
2163 | 657 |
! |
658 |
||
244 | 659 |
flushExposeEvents |
660 |
"throw away all pending expose events; this |
|
661 |
can be done after a full redraw (or in views, which are |
|
662 |
doing full redraws anly)" |
|
663 |
||
1790
a7f42261ab45
need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents:
1734
diff
changeset
|
664 |
self |
2137
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
665 |
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
|
666 |
|
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
667 |
"Modified: / 6.6.1998 / 21:18:03 / cg" |
144 | 668 |
! |
669 |
||
244 | 670 |
flushExposeEventsFor:aView |
671 |
"throw away all pending expose events for aView, |
|
672 |
or any view, if the argument is nil. |
|
673 |
This can be done after a full redraw |
|
674 |
(or in views, which are always doing full redraws - |
|
675 |
instead of drawing the clip-area only)" |
|
676 |
||
1790
a7f42261ab45
need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents:
1734
diff
changeset
|
677 |
self |
2137
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
678 |
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
|
679 |
|
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
680 |
"Modified: / 6.6.1998 / 21:18:05 / cg" |
244 | 681 |
! |
682 |
||
683 |
flushKeyboard |
|
684 |
"ST-80 compatibility: throw away all pending keyboard events" |
|
685 |
||
686 |
self flushKeyboardFor:nil |
|
687 |
! |
|
688 |
||
689 |
flushKeyboardFor:aView |
|
690 |
"throw away all pending keyboard events for aView, |
|
691 |
or any view, if the argument is nil." |
|
692 |
||
1790
a7f42261ab45
need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents:
1734
diff
changeset
|
693 |
self |
a7f42261ab45
need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents:
1734
diff
changeset
|
694 |
flushEventsFor:aView inQueue:mouseAndKeyboard |
2137
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
695 |
where:[:event | event isKeyEvent] |
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
696 |
|
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
697 |
"Modified: / 6.6.1998 / 21:18:08 / cg" |
244 | 698 |
! |
699 |
||
1731 | 700 |
flushMotionEventsFor:aView |
701 |
"throw away all pending motion events for aView, |
|
702 |
or for any view, if the argument is nil." |
|
703 |
||
1790
a7f42261ab45
need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents:
1734
diff
changeset
|
704 |
self |
a7f42261ab45
need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents:
1734
diff
changeset
|
705 |
flushEventsFor:aView inQueue:mouseAndKeyboard |
2137
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
706 |
where:[:event | event isButtonMotionEvent] |
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
707 |
|
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
708 |
"Modified: / 6.6.1998 / 21:18:10 / cg" |
1731 | 709 |
! |
710 |
||
244 | 711 |
flushUserEvents |
2163 | 712 |
"throw away all pending user events (i.e. key & button stuff)" |
244 | 713 |
|
714 |
(mouseAndKeyboard isNil or:[mouseAndKeyboard size > 0]) ifTrue:[ |
|
2163 | 715 |
self flushUserEventsFor:nil |
244 | 716 |
]. |
1159
e5247f8a48f3
do not flush synthetic events in #flushUserEvents
Claus Gittinger <cg@exept.de>
parents:
1155
diff
changeset
|
717 |
|
2163 | 718 |
"Modified: / 20.6.1998 / 16:40:02 / cg" |
244 | 719 |
! |
720 |
||
721 |
flushUserEventsFor:aView |
|
2163 | 722 |
"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
|
723 |
or for any view, if the argument is nil." |
244 | 724 |
|
1790
a7f42261ab45
need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents:
1734
diff
changeset
|
725 |
self |
a7f42261ab45
need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents:
1734
diff
changeset
|
726 |
flushEventsFor:aView inQueue:mouseAndKeyboard |
2137
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
727 |
where:[:event | event isUserEvent] |
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
728 |
|
2163 | 729 |
"Modified: / 20.6.1998 / 16:40:09 / cg" |
157 | 730 |
! ! |
731 |
||
732 |
!WindowSensor methodsFor:'event processing'! |
|
733 |
||
140 | 734 |
buttonMotion:state x:x y:y view:aView |
735 |
"mouse was moved - this is sent from the device (Display)" |
|
736 |
||
2439 | 737 |
|args ev ignoreIt| |
140 | 738 |
|
1100 | 739 |
"/ update my idea of shift/alt/ctrl pressed information |
740 |
self updateModifierStateFrom:state device:(aView graphicsDevice). |
|
741 |
||
140 | 742 |
EventListener notNil ifTrue:[ |
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
743 |
(EventListener buttonMotion:state x:x y:y view:aView) ifTrue:[^ self] |
140 | 744 |
]. |
745 |
eventListener notNil ifTrue:[ |
|
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
746 |
(eventListener buttonMotion:state x:x y:y view:aView) ifTrue:[^ self] |
140 | 747 |
]. |
748 |
||
749 |
ignoreUserInput == true ifTrue:[ |
|
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
750 |
^ self |
140 | 751 |
]. |
752 |
args := Array with:state with:x with:y. |
|
753 |
||
754 |
compressMotionEvents ifTrue:[ |
|
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
755 |
" |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
756 |
merge with last motion |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
757 |
" |
2137
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
758 |
self criticalUserEventQueueAccess:[ |
2439 | 759 |
|idx| |
760 |
||
761 |
idx := mouseAndKeyboard size. |
|
762 |
[idx > 0] whileTrue:[ |
|
763 |
ev := mouseAndKeyboard at:idx. |
|
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
764 |
ev notNil ifTrue:[ |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
765 |
((ev type == #buttonMotion:x:y:) |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
766 |
and:[(ev view == aView) |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
767 |
and:[(ev arguments at:1) == state]]) ifTrue:[ |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
768 |
ev arguments:args. |
2439 | 769 |
idx := 0. |
770 |
ignoreIt := true |
|
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
771 |
] |
2439 | 772 |
]. |
773 |
idx := idx - 1. |
|
774 |
]. |
|
775 |
]. |
|
776 |
ignoreIt == true ifTrue:[ |
|
777 |
^ self |
|
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
778 |
] |
140 | 779 |
]. |
1861
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
780 |
|
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
781 |
ev := WindowEvent buttonEvent |
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
782 |
for:aView |
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
783 |
type:#buttonMotion:x:y: |
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
784 |
arguments:args. |
1862
e56d9a7389bb
also remember buttonStates in keyEvents.
Claus Gittinger <cg@exept.de>
parents:
1861
diff
changeset
|
785 |
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
|
786 |
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
|
787 |
self pushEvent:ev. |
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
788 |
|
2439 | 789 |
"Modified: / 5.2.1999 / 21:23:31 / cg" |
140 | 790 |
! |
791 |
||
244 | 792 |
buttonMultiPress:button x:x y:y view:aView |
793 |
"mouse button was pressed - this is sent from the device (Display)" |
|
140 | 794 |
|
1861
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
795 |
|ev| |
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
796 |
|
1083
6e947cc67324
fixed #anyButtonPressed & setting of buttonDown-flags
Claus Gittinger <cg@exept.de>
parents:
1082
diff
changeset
|
797 |
self button:button inView:aView state:true. |
6e947cc67324
fixed #anyButtonPressed & setting of buttonDown-flags
Claus Gittinger <cg@exept.de>
parents:
1082
diff
changeset
|
798 |
|
140 | 799 |
EventListener notNil ifTrue:[ |
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
800 |
(EventListener buttonMultiPress:button x:x y:y view:aView) ifTrue:[^ self] |
140 | 801 |
]. |
802 |
eventListener notNil ifTrue:[ |
|
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
803 |
(eventListener buttonMultiPress:button x:x y:y view:aView) ifTrue:[^ self] |
140 | 804 |
]. |
805 |
||
806 |
ignoreUserInput == true ifTrue:[ |
|
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
807 |
^ self |
140 | 808 |
]. |
1083
6e947cc67324
fixed #anyButtonPressed & setting of buttonDown-flags
Claus Gittinger <cg@exept.de>
parents:
1082
diff
changeset
|
809 |
|
1861
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
810 |
ev := WindowEvent buttonEvent |
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
811 |
for:aView |
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
812 |
type:#buttonMultiPress:x:y: |
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
813 |
arguments:(Array with:button with:x with:y). |
1862
e56d9a7389bb
also remember buttonStates in keyEvents.
Claus Gittinger <cg@exept.de>
parents:
1861
diff
changeset
|
814 |
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
|
815 |
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
|
816 |
self pushEvent:ev. |
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
817 |
|
2126
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2123
diff
changeset
|
818 |
"Modified: / 21.5.1998 / 00:20:40 / cg" |
140 | 819 |
! |
820 |
||
821 |
buttonPress:button x:x y:y view:aView |
|
822 |
"mouse button was pressed - this is sent from the device (Display)" |
|
823 |
||
1861
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
824 |
|ev| |
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
825 |
|
157 | 826 |
self button:button inView:aView state:true. |
827 |
||
140 | 828 |
EventListener notNil ifTrue:[ |
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
829 |
(EventListener buttonPress:button x:x y:y view:aView) ifTrue:[^ self] |
140 | 830 |
]. |
831 |
eventListener notNil ifTrue:[ |
|
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
832 |
(eventListener buttonPress:button x:x y:y view:aView) ifTrue:[^ self] |
140 | 833 |
]. |
834 |
||
835 |
ignoreUserInput == true ifTrue:[ |
|
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
836 |
^ self |
140 | 837 |
]. |
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
838 |
|
1861
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
839 |
ev := WindowEvent buttonEvent |
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
840 |
for:aView |
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
841 |
type:#buttonPress:x:y: |
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
842 |
arguments:(Array with:button with:x with:y). |
1862
e56d9a7389bb
also remember buttonStates in keyEvents.
Claus Gittinger <cg@exept.de>
parents:
1861
diff
changeset
|
843 |
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
|
844 |
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
|
845 |
self pushEvent:ev. |
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
846 |
|
2126
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2123
diff
changeset
|
847 |
"Modified: / 21.5.1998 / 00:20:44 / cg" |
140 | 848 |
! |
849 |
||
244 | 850 |
buttonRelease:button x:x y:y view:aView |
851 |
"mouse button was released- this is sent from the device (Display)" |
|
852 |
||
1861
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
853 |
|ev| |
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
854 |
|
244 | 855 |
self button:button inView:aView state:false. |
856 |
||
857 |
EventListener notNil ifTrue:[ |
|
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
858 |
(EventListener buttonRelease:button x:x y:y view:aView) ifTrue:[^ self] |
244 | 859 |
]. |
860 |
eventListener notNil ifTrue:[ |
|
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
861 |
(eventListener buttonRelease:button x:x y:y view:aView) ifTrue:[^ self] |
244 | 862 |
]. |
863 |
||
864 |
ignoreUserInput == true ifTrue:[ |
|
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
865 |
^ self |
244 | 866 |
]. |
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
867 |
|
1861
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
868 |
ev := WindowEvent buttonEvent |
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
869 |
for:aView |
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
870 |
type:#buttonRelease:x:y: |
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
871 |
arguments:(Array with:button with:x with:y). |
1862
e56d9a7389bb
also remember buttonStates in keyEvents.
Claus Gittinger <cg@exept.de>
parents:
1861
diff
changeset
|
872 |
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
|
873 |
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
|
874 |
self pushEvent:ev. |
1b1e49147380
remember shift,meta,alt & ctrl state in buttonEvents
Claus Gittinger <cg@exept.de>
parents:
1852
diff
changeset
|
875 |
|
2126
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2123
diff
changeset
|
876 |
"Modified: / 21.5.1998 / 00:21:19 / cg" |
244 | 877 |
! |
878 |
||
1545 | 879 |
clientMessage:type format:format eventData:data view:aView |
880 |
"some other data sent to a view. |
|
881 |
This is an X-specific event." |
|
882 |
||
2126
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2123
diff
changeset
|
883 |
self pushEvent:(WindowEvent |
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2123
diff
changeset
|
884 |
clientEvent |
1545 | 885 |
for:aView |
886 |
type:#clientMessage:format:eventData: |
|
887 |
arguments:(Array with:type with:format with:data)). |
|
888 |
||
2126
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2123
diff
changeset
|
889 |
"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
|
890 |
"Modified: / 21.5.1998 / 00:20:56 / cg" |
1545 | 891 |
! |
892 |
||
244 | 893 |
configureX:x y:y width:w height:h view:aView |
894 |
"a views size or position has changed - this is sent from the device (Display)" |
|
895 |
||
1108
748f9e5c5b1e
ignore configureEvents for subviews.
Claus Gittinger <cg@exept.de>
parents:
1100
diff
changeset
|
896 |
aView superView notNil ifTrue:[ |
1969
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
897 |
"/ this is a configure event for a subView |
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
898 |
"/ I guess, this resulted from a resize of |
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
899 |
"/ myself (are there any windowManagers which resize subviews ?) |
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
900 |
"/ Therefore, ignore it here. |
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
901 |
"/ 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
|
902 |
"/ 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
|
903 |
"/ 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
|
904 |
"/ 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
|
905 |
|
2429
c54c8e30fe13
support for external topViews.
Claus Gittinger <cg@exept.de>
parents:
2421
diff
changeset
|
906 |
"/ A kludge-workaround had to be added to children of |
c54c8e30fe13
support for external topViews.
Claus Gittinger <cg@exept.de>
parents:
2421
diff
changeset
|
907 |
"/ external top views - since the external view does not get any |
c54c8e30fe13
support for external topViews.
Claus Gittinger <cg@exept.de>
parents:
2421
diff
changeset
|
908 |
"/ events delivered, we must react upon changes of the |
c54c8e30fe13
support for external topViews.
Claus Gittinger <cg@exept.de>
parents:
2421
diff
changeset
|
909 |
"/ child. (sigh). |
c54c8e30fe13
support for external topViews.
Claus Gittinger <cg@exept.de>
parents:
2421
diff
changeset
|
910 |
aView superView isExternalTopView ifFalse:[ |
c54c8e30fe13
support for external topViews.
Claus Gittinger <cg@exept.de>
parents:
2421
diff
changeset
|
911 |
"/ 'ignored configure for: ' print. aView class printCR. |
c54c8e30fe13
support for external topViews.
Claus Gittinger <cg@exept.de>
parents:
2421
diff
changeset
|
912 |
^ self |
c54c8e30fe13
support for external topViews.
Claus Gittinger <cg@exept.de>
parents:
2421
diff
changeset
|
913 |
] |
1969
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
914 |
]. |
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
915 |
|
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
916 |
"/ |
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
917 |
"/ experimental: only queue one confif event (WIN32 speedup) |
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
918 |
"/ |
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
919 |
damage size ~~ 0 ifTrue:[ |
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
920 |
damage do:[:aDamage | |
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
921 |
aDamage notNil ifTrue:[ |
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
922 |
aDamage type == #configureX:y:width:height: ifTrue:[ |
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
923 |
aDamage view == aView ifTrue:[ |
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
924 |
aDamage |
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
925 |
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
|
926 |
^ false |
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
927 |
] |
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
928 |
] |
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
929 |
]. |
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
930 |
] |
1108
748f9e5c5b1e
ignore configureEvents for subviews.
Claus Gittinger <cg@exept.de>
parents:
1100
diff
changeset
|
931 |
]. |
748f9e5c5b1e
ignore configureEvents for subviews.
Claus Gittinger <cg@exept.de>
parents:
1100
diff
changeset
|
932 |
|
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
933 |
self pushDamageEvent:(WindowEvent |
1969
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
934 |
for:aView |
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
935 |
type:#configureX:y:width:height: |
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
936 |
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
|
937 |
|
d2d7073b7c56
experimental: only enqueue last configure event
Claus Gittinger <cg@exept.de>
parents:
1940
diff
changeset
|
938 |
"Modified: / 8.12.1997 / 19:16:12 / cg" |
244 | 939 |
! |
940 |
||
941 |
coveredBy:sibling view:aView |
|
942 |
"aView was covered by one of its siblings - this is sent from the device (Display)" |
|
943 |
||
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
944 |
self pushDamageEvent:(WindowEvent |
1271 | 945 |
for:aView |
946 |
type:#coveredBy: |
|
947 |
arguments:(Array with:sibling)). |
|
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
948 |
|
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
949 |
"Modified: 18.1.1997 / 14:18:32 / cg" |
244 | 950 |
! |
951 |
||
952 |
destroyedView:aView |
|
953 |
"view was destroyed (from window manager) - this is sent from the device (Display)" |
|
954 |
||
955 |
"at this time, the view is already gone; remove |
|
956 |
all pending events for this one ..." |
|
957 |
||
958 |
self flushEventsFor:aView. |
|
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
959 |
self pushDamageEvent:(WindowEvent |
1271 | 960 |
for:aView |
961 |
type:#destroyed). |
|
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
962 |
|
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
963 |
"Modified: 18.1.1997 / 14:18:19 / cg" |
244 | 964 |
! |
965 |
||
1545 | 966 |
dropMessage:dropType data:dropValue view:aView |
967 |
"a drop sent to a view. The dropType is a symbolic specifier, |
|
968 |
which may be ignored, since the dropValue has already been |
|
969 |
converted into an ST/X dropObject." |
|
970 |
||
971 |
self pushEvent:(WindowEvent |
|
972 |
for:aView |
|
973 |
type:#dropMessage:data: |
|
974 |
arguments:(Array with:dropType with:dropValue)). |
|
975 |
||
976 |
"Created: 4.4.1997 / 18:13:41 / cg" |
|
977 |
"Modified: 4.4.1997 / 18:55:25 / cg" |
|
978 |
! |
|
979 |
||
244 | 980 |
exposeX:left y:top width:width height:height view:aView |
981 |
"an expose event arrived - this is sent from the device (Display)" |
|
982 |
||
703
4324ab5e3630
added facility to lock expose event queue (temporary kludge ?)
Claus Gittinger <cg@exept.de>
parents:
612
diff
changeset
|
983 |
ignoreExposeEvents ~~ true ifTrue:[ |
1851
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
984 |
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
|
985 |
view:aView |
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
986 |
wakeup:true. |
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
987 |
] ifFalse:[ |
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
988 |
'ignored expose' printCR |
244 | 989 |
] |
703
4324ab5e3630
added facility to lock expose event queue (temporary kludge ?)
Claus Gittinger <cg@exept.de>
parents:
612
diff
changeset
|
990 |
|
2397 | 991 |
"Modified: / 9.11.1998 / 14:23:01 / cg" |
140 | 992 |
! |
993 |
||
994 |
focusInView:aView |
|
995 |
"view got input focus - this is sent from the device (Display)" |
|
996 |
||
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
997 |
self pushEvent:(WindowEvent |
1331 | 998 |
for:aView |
999 |
type:#focusIn). |
|
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1000 |
|
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1001 |
"Modified: 18.1.1997 / 14:07:01 / cg" |
140 | 1002 |
! |
1003 |
||
244 | 1004 |
focusOutView:aView |
1005 |
"view lost input focus - this is sent from the device (Display)" |
|
140 | 1006 |
|
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1007 |
self pushEvent:(WindowEvent |
1331 | 1008 |
for:aView |
1009 |
type:#focusOut). |
|
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1010 |
|
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1011 |
"Modified: 18.1.1997 / 14:07:09 / cg" |
140 | 1012 |
! |
1013 |
||
1295
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
1014 |
graphicsExposeX:left y:top width:width height:height final:final view:aView |
244 | 1015 |
"a graphic expose event arrived - this is sent from the device (Display)" |
140 | 1016 |
|
1243
0c33cb7f8458
hopefully fixed the 'lost expose' bug
Claus Gittinger <cg@exept.de>
parents:
1242
diff
changeset
|
1017 |
"/ 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
|
1018 |
"/ (if an expose is pending) |
0c33cb7f8458
hopefully fixed the 'lost expose' bug
Claus Gittinger <cg@exept.de>
parents:
1242
diff
changeset
|
1019 |
|
1295
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
1020 |
final ifTrue:[ |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
1021 |
(catchExpose includes:aView) ifTrue:[ |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
1022 |
gotExpose add:aView. |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
1023 |
exposeEventSemaphore signalForAll |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
1024 |
] ifFalse:[ |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
1025 |
'WSensor [warning]: got exposeEvent for non-catching view:' infoPrint. aView infoPrintCR |
1271 | 1026 |
] |
1243
0c33cb7f8458
hopefully fixed the 'lost expose' bug
Claus Gittinger <cg@exept.de>
parents:
1242
diff
changeset
|
1027 |
]. |
0c33cb7f8458
hopefully fixed the 'lost expose' bug
Claus Gittinger <cg@exept.de>
parents:
1242
diff
changeset
|
1028 |
|
751 | 1029 |
self addDamage:(left @ top extent:width @ height) view:aView wakeup:false. |
1030 |
||
1268
612204a36c38
no, regular expose events should not trigger the exposeSema
Claus Gittinger <cg@exept.de>
parents:
1264
diff
changeset
|
1031 |
"Modified: 23.1.1997 / 22:15:53 / cg" |
140 | 1032 |
! |
1033 |
||
1034 |
keyPress:key x:x y:y view:aView |
|
1035 |
"key was pressed - this is sent from the device (Display). |
|
1036 |
beside the keyboard translation, CntlC processing is done here." |
|
1037 |
||
510 | 1038 |
<resource: #keyboard ( #Compose #DestroyView #DestroyTopView #FlushInput |
2123
b2dae4453526
added additional key: #UserAbort (CTRL-y),
Claus Gittinger <cg@exept.de>
parents:
2090
diff
changeset
|
1039 |
#UserInterrupt #UserAbort) > |
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1040 |
|
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1041 |
|xlatedKey group process ev| |
140 | 1042 |
|
144 | 1043 |
self key:key state:true. |
1044 |
||
2413 | 1045 |
"/ bail out of a popUpView with ctrl-escape |
1046 |
"/ (useful to avoid total lock of system with non-functioning grabbing opUpView) |
|
1047 |
(key == #Escape) ifTrue:[ |
|
1048 |
aView isPopUpView ifTrue:[ |
|
1049 |
ctrlDown ifTrue:[ |
|
1050 |
aView device ungrabPointer. |
|
1051 |
aView device ungrabKeyboard. |
|
1052 |
aView destroy. |
|
1053 |
^ self |
|
1054 |
] |
|
1055 |
] |
|
1056 |
]. |
|
1057 |
||
140 | 1058 |
EventListener notNil ifTrue:[ |
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1059 |
(EventListener keyPress:key x:x y:y view:aView) ifTrue:[^ self] |
140 | 1060 |
]. |
1061 |
eventListener notNil ifTrue:[ |
|
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1062 |
(eventListener keyPress:key x:x y:y view:aView) ifTrue:[^ self] |
140 | 1063 |
]. |
1064 |
keyboardListener notNil ifTrue:[ |
|
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1065 |
(keyboardListener keyPress:key x:x y:y view:aView) ifTrue:[^ self] |
140 | 1066 |
]. |
1067 |
||
1068 |
translateKeyboardEvents ifTrue:[ |
|
2141 | 1069 |
xlatedKey := aView graphicsDevice translateKey:key forView:aView. |
140 | 1070 |
] ifFalse:[ |
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1071 |
xlatedKey := key. |
140 | 1072 |
]. |
157 | 1073 |
|
140 | 1074 |
xlatedKey isNil ifTrue:[^ self]. |
1075 |
||
157 | 1076 |
(xlatedKey == #Compose) ifTrue:[ |
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1077 |
GotCompose := true. Compose1 := nil. |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1078 |
^ self |
157 | 1079 |
]. |
1080 |
GotCompose == true ifTrue:[ |
|
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1081 |
Compose1 isNil ifTrue:[ |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1082 |
(self isModifierKey:xlatedKey) ifFalse:[ |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1083 |
Compose1 := xlatedKey. |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1084 |
]. |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1085 |
^ self |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1086 |
]. |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1087 |
(self isModifierKey:xlatedKey) ifFalse:[ |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1088 |
xlatedKey := self compose:Compose1 with:xlatedKey. |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1089 |
Compose1 := nil. GotCompose := false. |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1090 |
] |
157 | 1091 |
]. |
1092 |
||
1093 |
(xlatedKey == #CmdCtrlV) ifTrue:[ |
|
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1094 |
'Smalltalk/X ' errorPrint. |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1095 |
Smalltalk versionString errorPrint. ' of ' errorPrint. |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1096 |
Smalltalk versionDate errorPrintCR. |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1097 |
Smalltalk copyrightString errorPrintCR. |
140 | 1098 |
]. |
1099 |
||
157 | 1100 |
(xlatedKey == #DestroyView) ifTrue:[ |
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1101 |
aView closeRequest. |
157 | 1102 |
]. |
1103 |
(xlatedKey == #DestroyTopView) ifTrue:[ |
|
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1104 |
aView topView closeRequest. |
157 | 1105 |
]. |
1106 |
||
152 | 1107 |
(xlatedKey == #FlushInput) ifTrue:[ |
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1108 |
"this removes any enqueued user events - |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1109 |
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
|
1110 |
" |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1111 |
self flushUserEvents. |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1112 |
^ self |
152 | 1113 |
]. |
1114 |
||
2123
b2dae4453526
added additional key: #UserAbort (CTRL-y),
Claus Gittinger <cg@exept.de>
parents:
2090
diff
changeset
|
1115 |
(((xlatedKey == #UserInterrupt) and:[ControlCEnabled]) |
b2dae4453526
added additional key: #UserAbort (CTRL-y),
Claus Gittinger <cg@exept.de>
parents:
2090
diff
changeset
|
1116 |
or:[((xlatedKey == #UserAbort) and:[ControlYEnabled])]) ifTrue:[ |
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1117 |
" |
2123
b2dae4453526
added additional key: #UserAbort (CTRL-y),
Claus Gittinger <cg@exept.de>
parents:
2090
diff
changeset
|
1118 |
Special handling for |
b2dae4453526
added additional key: #UserAbort (CTRL-y),
Claus Gittinger <cg@exept.de>
parents:
2090
diff
changeset
|
1119 |
Ctrl-C: interrupt the underlying process. |
b2dae4453526
added additional key: #UserAbort (CTRL-y),
Claus Gittinger <cg@exept.de>
parents:
2090
diff
changeset
|
1120 |
and: |
b2dae4453526
added additional key: #UserAbort (CTRL-y),
Claus Gittinger <cg@exept.de>
parents:
2090
diff
changeset
|
1121 |
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
|
1122 |
|
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1123 |
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
|
1124 |
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
|
1125 |
perform the userInterrupt in the interrupt-method. |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1126 |
" |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1127 |
group := aView windowGroup. |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1128 |
group notNil ifTrue:[ |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1129 |
process := group process. |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1130 |
process notNil ifTrue:[ |
2123
b2dae4453526
added additional key: #UserAbort (CTRL-y),
Claus Gittinger <cg@exept.de>
parents:
2090
diff
changeset
|
1131 |
(xlatedKey == #UserAbort) ifTrue:[ |
b2dae4453526
added additional key: #UserAbort (CTRL-y),
Claus Gittinger <cg@exept.de>
parents:
2090
diff
changeset
|
1132 |
process interruptWith:[:where | AbortSignal raise] |
b2dae4453526
added additional key: #UserAbort (CTRL-y),
Claus Gittinger <cg@exept.de>
parents:
2090
diff
changeset
|
1133 |
] ifFalse:[ |
b2dae4453526
added additional key: #UserAbort (CTRL-y),
Claus Gittinger <cg@exept.de>
parents:
2090
diff
changeset
|
1134 |
process interruptWith:[:where | process userInterruptIn:where] |
b2dae4453526
added additional key: #UserAbort (CTRL-y),
Claus Gittinger <cg@exept.de>
parents:
2090
diff
changeset
|
1135 |
] |
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1136 |
] |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1137 |
]. |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1138 |
^ self |
140 | 1139 |
]. |
1140 |
||
1141 |
ignoreUserInput == true ifTrue:[ |
|
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1142 |
^ self |
140 | 1143 |
]. |
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1144 |
|
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1145 |
ev := WindowEvent keyboardEvent |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1146 |
for:aView |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1147 |
type:#keyPress:x:y: |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1148 |
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
|
1149 |
ev rawKey:key. |
1862
e56d9a7389bb
also remember buttonStates in keyEvents.
Claus Gittinger <cg@exept.de>
parents:
1861
diff
changeset
|
1150 |
ev hasShift:shiftDown ctrl:ctrlDown alt:altDown meta:metaDown |
e56d9a7389bb
also remember buttonStates in keyEvents.
Claus Gittinger <cg@exept.de>
parents:
1861
diff
changeset
|
1151 |
button1:leftButtonDown button2:middleButtonDown button3:rightButtonDown. |
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1152 |
self pushEvent:ev. |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1153 |
|
2413 | 1154 |
"Modified: / 4.12.1998 / 15:35:32 / cg" |
140 | 1155 |
! |
1156 |
||
1157 |
keyRelease:key x:x y:y view:aView |
|
1158 |
"key was released - this is sent from the device (Display)." |
|
1159 |
||
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1160 |
|xlatedKey ev| |
140 | 1161 |
|
144 | 1162 |
self key:key state:false. |
1163 |
||
140 | 1164 |
EventListener notNil ifTrue:[ |
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1165 |
(EventListener keyRelease:key x:x y:y view:aView) ifTrue:[^ self] |
140 | 1166 |
]. |
1167 |
eventListener notNil ifTrue:[ |
|
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1168 |
(eventListener keyRelease:key x:x y:y view:aView) ifTrue:[^ self] |
140 | 1169 |
]. |
1170 |
keyboardListener notNil ifTrue:[ |
|
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1171 |
(keyboardListener keyRelease:key x:x y:y view:aView) ifTrue:[^ self] |
140 | 1172 |
]. |
1173 |
||
1174 |
ignoreUserInput == true ifTrue:[ |
|
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1175 |
^ self |
140 | 1176 |
]. |
1177 |
translateKeyboardEvents ifTrue:[ |
|
2141 | 1178 |
xlatedKey := aView graphicsDevice translateKey:key forView:aView. |
140 | 1179 |
] ifFalse:[ |
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1180 |
xlatedKey := key. |
140 | 1181 |
]. |
1182 |
xlatedKey isNil ifTrue:[^ self]. |
|
1183 |
||
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1184 |
ev := WindowEvent keyboardEvent |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1185 |
for:aView |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1186 |
type:#keyRelease:x:y: |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1187 |
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
|
1188 |
ev rawKey:key. |
1862
e56d9a7389bb
also remember buttonStates in keyEvents.
Claus Gittinger <cg@exept.de>
parents:
1861
diff
changeset
|
1189 |
ev hasShift:shiftDown ctrl:ctrlDown alt:altDown meta:metaDown |
e56d9a7389bb
also remember buttonStates in keyEvents.
Claus Gittinger <cg@exept.de>
parents:
1861
diff
changeset
|
1190 |
button1:leftButtonDown button2:middleButtonDown button3:rightButtonDown. |
1528
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1191 |
|
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1192 |
self pushEvent:ev. |
78c64c132593
started to separate into distinct event classes;
Claus Gittinger <cg@exept.de>
parents:
1512
diff
changeset
|
1193 |
|
1862
e56d9a7389bb
also remember buttonStates in keyEvents.
Claus Gittinger <cg@exept.de>
parents:
1861
diff
changeset
|
1194 |
"Modified: 13.8.1997 / 22:19:22 / cg" |
140 | 1195 |
! |
1196 |
||
244 | 1197 |
mappedView:aView |
1198 |
"view was mapped (from window manager) - this is sent from the device (Display)" |
|
140 | 1199 |
|
2058
59a52789086a
fixed (I hope) redraw bug in debugView
Claus Gittinger <cg@exept.de>
parents:
2052
diff
changeset
|
1200 |
self flushExposeEventsFor:aView. |
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1201 |
self pushDamageEvent:(WindowEvent |
1851
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1202 |
for:aView |
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1203 |
type:#mapped). |
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1204 |
|
2058
59a52789086a
fixed (I hope) redraw bug in debugView
Claus Gittinger <cg@exept.de>
parents:
2052
diff
changeset
|
1205 |
"Modified: / 16.2.1998 / 13:20:41 / cg" |
244 | 1206 |
! |
1207 |
||
1208 |
noExposeView:aView |
|
1209 |
"an noexpose event arrived - this is sent from the device (Display)" |
|
1210 |
||
1295
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
1211 |
(catchExpose includes:aView) ifTrue:[ |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
1212 |
gotExpose add:aView. |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
1213 |
exposeEventSemaphore signalForAll |
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1214 |
] ifFalse:[ |
1295
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
1215 |
'WSensor [warning]: got noExpose for non-catching view:' infoPrint. aView infoPrintCR |
244 | 1216 |
] |
1217 |
! |
|
1218 |
||
1340
f028f125f606
pasteFromClipBoard: must go through the sensor
Claus Gittinger <cg@exept.de>
parents:
1331
diff
changeset
|
1219 |
pasteFromClipBoard:something view:aView |
f028f125f606
pasteFromClipBoard: must go through the sensor
Claus Gittinger <cg@exept.de>
parents:
1331
diff
changeset
|
1220 |
"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
|
1221 |
|
f028f125f606
pasteFromClipBoard: must go through the sensor
Claus Gittinger <cg@exept.de>
parents:
1331
diff
changeset
|
1222 |
self pushEvent:(WindowEvent |
f028f125f606
pasteFromClipBoard: must go through the sensor
Claus Gittinger <cg@exept.de>
parents:
1331
diff
changeset
|
1223 |
for:aView |
f028f125f606
pasteFromClipBoard: must go through the sensor
Claus Gittinger <cg@exept.de>
parents:
1331
diff
changeset
|
1224 |
type:#pasteFromClipBoard: |
f028f125f606
pasteFromClipBoard: must go through the sensor
Claus Gittinger <cg@exept.de>
parents:
1331
diff
changeset
|
1225 |
arguments:(Array with:something)). |
f028f125f606
pasteFromClipBoard: must go through the sensor
Claus Gittinger <cg@exept.de>
parents:
1331
diff
changeset
|
1226 |
|
f028f125f606
pasteFromClipBoard: must go through the sensor
Claus Gittinger <cg@exept.de>
parents:
1331
diff
changeset
|
1227 |
"Modified: 18.1.1997 / 14:07:25 / cg" |
f028f125f606
pasteFromClipBoard: must go through the sensor
Claus Gittinger <cg@exept.de>
parents:
1331
diff
changeset
|
1228 |
"Created: 13.2.1997 / 13:40:24 / cg" |
f028f125f606
pasteFromClipBoard: must go through the sensor
Claus Gittinger <cg@exept.de>
parents:
1331
diff
changeset
|
1229 |
! |
f028f125f606
pasteFromClipBoard: must go through the sensor
Claus Gittinger <cg@exept.de>
parents:
1331
diff
changeset
|
1230 |
|
244 | 1231 |
pointerEnter:state x:x y:y view:aView |
1232 |
"mouse cursor was moved into the view - this is sent from the device (Display)" |
|
1233 |
||
1864
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1234 |
|ev| |
244 | 1235 |
|
1100 | 1236 |
"/ update my idea of shift/alt/ctrl pressed information |
1237 |
self updateModifierStateFrom:state device:(aView graphicsDevice). |
|
1238 |
||
244 | 1239 |
EventListener notNil ifTrue:[ |
1864
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1240 |
(EventListener pointerEnter:state x:x y:y view:aView) ifTrue:[^ self] |
244 | 1241 |
]. |
1242 |
eventListener notNil ifTrue:[ |
|
1864
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1243 |
(eventListener pointerEnter:state x:x y:y view:aView) ifTrue:[^ self] |
244 | 1244 |
]. |
1245 |
||
1864
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:#pointerEnter:x:y: |
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1249 |
arguments:(Array with:state with:x with:y). |
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:09 / cg" |
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1256 |
! |
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1257 |
|
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1258 |
pointerLeave:state view:aView |
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1259 |
"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
|
1260 |
|
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1261 |
|ev| |
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1262 |
|
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1263 |
"/ 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
|
1264 |
self updateModifierStateFrom:state device:(aView graphicsDevice). |
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1265 |
|
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1266 |
EventListener notNil ifTrue:[ |
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1267 |
(EventListener pointerLeave:state view:aView) ifTrue:[^ self] |
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1268 |
]. |
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1269 |
eventListener notNil ifTrue:[ |
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1270 |
(eventListener pointerLeave:state view:aView) ifTrue:[^ self] |
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1271 |
]. |
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1272 |
|
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1273 |
ev := WindowEvent inputEvent |
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1274 |
for:aView |
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1275 |
type:#pointerLeave: |
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1276 |
arguments:(Array with:state). |
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1277 |
|
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1278 |
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
|
1279 |
button1:leftButtonDown button2:middleButtonDown button3:rightButtonDown. |
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1280 |
self pushEvent:ev. |
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1281 |
|
4aeff6edaab6
remember modifiers in pointerEnter/Leave events
Claus Gittinger <cg@exept.de>
parents:
1862
diff
changeset
|
1282 |
"Modified: 13.8.1997 / 23:04:13 / cg" |
140 | 1283 |
! |
1284 |
||
1285 |
saveAndTerminateView:aView |
|
1286 |
"view should save & terminate (from window manager) - this is sent from the device (Display)" |
|
1287 |
||
1288 |
self flushEventsFor:aView. |
|
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1289 |
self pushDamageEvent:(WindowEvent |
1271 | 1290 |
for:aView |
1291 |
type:#saveAndTerminate). |
|
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1292 |
|
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1293 |
"Modified: 18.1.1997 / 14:17:37 / cg" |
140 | 1294 |
! |
1295 |
||
244 | 1296 |
terminateView:aView |
1297 |
"view should terminate (from window manager) - this is sent from the device (Display)" |
|
140 | 1298 |
|
1299 |
self flushEventsFor:aView. |
|
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1300 |
self pushDamageEvent:(WindowEvent |
1271 | 1301 |
for:aView |
1302 |
type:#terminate). |
|
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1303 |
|
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1304 |
"Modified: 18.1.1997 / 14:17:24 / cg" |
244 | 1305 |
! |
1306 |
||
1307 |
unmappedView:aView |
|
1308 |
"view was unmapped (from window manager) - this is sent from the device (Display)" |
|
1309 |
||
2058
59a52789086a
fixed (I hope) redraw bug in debugView
Claus Gittinger <cg@exept.de>
parents:
2052
diff
changeset
|
1310 |
self flushExposeEventsFor:aView. |
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1311 |
self pushDamageEvent:(WindowEvent |
2058
59a52789086a
fixed (I hope) redraw bug in debugView
Claus Gittinger <cg@exept.de>
parents:
2052
diff
changeset
|
1312 |
for:aView |
59a52789086a
fixed (I hope) redraw bug in debugView
Claus Gittinger <cg@exept.de>
parents:
2052
diff
changeset
|
1313 |
type:#unmapped). |
59a52789086a
fixed (I hope) redraw bug in debugView
Claus Gittinger <cg@exept.de>
parents:
2052
diff
changeset
|
1314 |
|
59a52789086a
fixed (I hope) redraw bug in debugView
Claus Gittinger <cg@exept.de>
parents:
2052
diff
changeset
|
1315 |
"Modified: / 16.2.1998 / 13:20:37 / cg" |
0 | 1316 |
! ! |
1317 |
||
581 | 1318 |
!WindowSensor methodsFor:'event processing - private'! |
1319 |
||
1320 |
button:button inView:aView state:onOrOff |
|
1321 |
"update the state of the xxxButtonDown flags" |
|
1322 |
||
1323 |
|physicalButton| |
|
1324 |
||
743 | 1325 |
physicalButton := aView graphicsDevice buttonTranslation keyAtValue:button ifAbsent:button. |
1084 | 1326 |
|
581 | 1327 |
(physicalButton == 1) ifTrue:[ |
1271 | 1328 |
leftButtonDown := onOrOff. |
1329 |
^ self |
|
581 | 1330 |
]. |
1331 |
(physicalButton == 2) ifTrue:[ |
|
1271 | 1332 |
middleButtonDown := onOrOff. |
1333 |
^ self |
|
581 | 1334 |
]. |
1335 |
(physicalButton == 3) ifTrue:[ |
|
1271 | 1336 |
rightButtonDown := onOrOff. |
1337 |
^ self |
|
581 | 1338 |
]. |
743 | 1339 |
|
1084 | 1340 |
"Modified: 21.10.1996 / 11:47:35 / cg" |
581 | 1341 |
! |
1342 |
||
1343 |
compose:key1 with:key2 |
|
1344 |
"compose a 2-character sequence into a composed key" |
|
1345 |
||
1346 |
ComposeTable do:[:entry | |
|
1347 |
|v| |
|
1348 |
||
1349 |
((key1 == (entry at:1)) and:[key2 == (entry at:2)]) ifTrue:[ |
|
1350 |
v := entry at:3. |
|
1351 |
v isCharacter ifFalse:[v := Character value:v]. |
|
1352 |
^ v |
|
1353 |
] |
|
1354 |
]. |
|
1355 |
"/ |
|
1356 |
"/ for illegal sequence, return 2nd key |
|
1357 |
"/ |
|
1358 |
"/ key1 print. ' ' print. key2 printNL. |
|
1359 |
^ key2 |
|
1360 |
! |
|
1361 |
||
1362 |
isModifierKey:key |
|
1363 |
"return true if key is a modifier (Alt, Shift, Ctrl or Meta)" |
|
1364 |
||
1365 |
(key == #Shift |
|
1366 |
or:[key == #'Shift_R' |
|
1367 |
or:[key == #'Shift_L']]) ifTrue:[ |
|
2262
c97df93c1781
Ctrl is handled like Control (WinWorkstation bug workaround)
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1368 |
^ true |
581 | 1369 |
]. |
1370 |
(key == #Alt |
|
1371 |
or:[key == #'Alt_R' or:[key == #'Alt_L']]) ifTrue:[ |
|
2262
c97df93c1781
Ctrl is handled like Control (WinWorkstation bug workaround)
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1372 |
^ true |
581 | 1373 |
]. |
1374 |
(key == #Meta |
|
1375 |
or:[key == #'Meta_R' or:[key == #'Meta_L']]) ifTrue:[ |
|
2262
c97df93c1781
Ctrl is handled like Control (WinWorkstation bug workaround)
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1376 |
^ true |
c97df93c1781
Ctrl is handled like Control (WinWorkstation bug workaround)
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1377 |
]. |
c97df93c1781
Ctrl is handled like Control (WinWorkstation bug workaround)
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1378 |
(key == #Ctrl |
c97df93c1781
Ctrl is handled like Control (WinWorkstation bug workaround)
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1379 |
or:[key == #'Ctrl_R' or:[key == #'Ctrl_L']]) ifTrue:[ |
c97df93c1781
Ctrl is handled like Control (WinWorkstation bug workaround)
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1380 |
^ true |
581 | 1381 |
]. |
1382 |
(key == #Control |
|
1383 |
or:[key == #'Control_R' or:[key == #'Control_L']]) ifTrue:[ |
|
2262
c97df93c1781
Ctrl is handled like Control (WinWorkstation bug workaround)
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1384 |
^ true |
581 | 1385 |
]. |
1386 |
^ false |
|
1387 |
||
2262
c97df93c1781
Ctrl is handled like Control (WinWorkstation bug workaround)
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1388 |
"Modified: / 22.8.1998 / 02:33:46 / cg" |
581 | 1389 |
! |
1390 |
||
1391 |
key:key state:onOrOff |
|
1392 |
"update the state of the shiftDown/metaDown and ctrlDown |
|
1393 |
flags" |
|
1394 |
||
1395 |
(key = #Shift |
|
1396 |
or:[key = #'Shift_R' |
|
1397 |
or:[key = #'Shift_L']]) ifTrue:[ |
|
2262
c97df93c1781
Ctrl is handled like Control (WinWorkstation bug workaround)
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1398 |
shiftDown := onOrOff. |
c97df93c1781
Ctrl is handled like Control (WinWorkstation bug workaround)
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1399 |
^ self |
581 | 1400 |
]. |
1401 |
(key = #Alt |
|
1402 |
or:[key = #'Alt_R' or:[key = #'Alt_L']]) ifTrue:[ |
|
2262
c97df93c1781
Ctrl is handled like Control (WinWorkstation bug workaround)
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1403 |
altDown := onOrOff. |
c97df93c1781
Ctrl is handled like Control (WinWorkstation bug workaround)
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1404 |
^ self |
581 | 1405 |
]. |
1406 |
(key = #Meta |
|
1407 |
or:[key = #'Meta_R' or:[key = #'Meta_L']]) ifTrue:[ |
|
2262
c97df93c1781
Ctrl is handled like Control (WinWorkstation bug workaround)
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1408 |
metaDown := onOrOff. |
c97df93c1781
Ctrl is handled like Control (WinWorkstation bug workaround)
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1409 |
^ self |
c97df93c1781
Ctrl is handled like Control (WinWorkstation bug workaround)
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1410 |
]. |
c97df93c1781
Ctrl is handled like Control (WinWorkstation bug workaround)
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1411 |
(key = #Ctrl |
c97df93c1781
Ctrl is handled like Control (WinWorkstation bug workaround)
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1412 |
or:[key = #'Ctrl_R' or:[key = #'Ctrl_L']]) ifTrue:[ |
c97df93c1781
Ctrl is handled like Control (WinWorkstation bug workaround)
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1413 |
ctrlDown := onOrOff. |
c97df93c1781
Ctrl is handled like Control (WinWorkstation bug workaround)
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1414 |
^ self |
581 | 1415 |
]. |
1416 |
(key = #Control |
|
1417 |
or:[key = #'Control_R' or:[key = #'Control_L']]) ifTrue:[ |
|
2262
c97df93c1781
Ctrl is handled like Control (WinWorkstation bug workaround)
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1418 |
ctrlDown := onOrOff. |
c97df93c1781
Ctrl is handled like Control (WinWorkstation bug workaround)
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1419 |
^ self |
581 | 1420 |
]. |
2262
c97df93c1781
Ctrl is handled like Control (WinWorkstation bug workaround)
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1421 |
|
c97df93c1781
Ctrl is handled like Control (WinWorkstation bug workaround)
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1422 |
"Modified: / 22.8.1998 / 02:33:04 / cg" |
581 | 1423 |
! |
1424 |
||
1295
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
1425 |
notifyEventArrival:aView |
581 | 1426 |
"an event arrived - if there is an eventSemaphore, |
1427 |
signal it, to wake up any windowGroup process" |
|
1428 |
||
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1429 |
(catchExpose includesIdentical:aView) ifTrue:[ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1430 |
" |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1431 |
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
|
1432 |
but remember arrival of something. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1433 |
" |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1434 |
gotOtherEvent add:aView. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1435 |
^ self |
581 | 1436 |
]. |
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1437 |
|
581 | 1438 |
eventSemaphore notNil ifTrue:[ |
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1439 |
"/ eventSemaphore signal |
1184
1372bad824af
single trigger on the eventSemaphore is ok
Claus Gittinger <cg@exept.de>
parents:
1179
diff
changeset
|
1440 |
|
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1441 |
"/ can get along with a single trigger; |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1442 |
"/ because processEvents will read all events |
1184
1372bad824af
single trigger on the eventSemaphore is ok
Claus Gittinger <cg@exept.de>
parents:
1179
diff
changeset
|
1443 |
|
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1444 |
eventSemaphore signalOnce |
581 | 1445 |
] |
1184
1372bad824af
single trigger on the eventSemaphore is ok
Claus Gittinger <cg@exept.de>
parents:
1179
diff
changeset
|
1446 |
|
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1447 |
"Modified: 8.2.1997 / 12:01:48 / cg" |
581 | 1448 |
! |
1449 |
||
2312
0ec069be9679
mhmh - allButtonStates query is very slow sometimes;
Claus Gittinger <cg@exept.de>
parents:
2262
diff
changeset
|
1450 |
updateModifierStateFrom:stateIn device:aDevice |
0ec069be9679
mhmh - allButtonStates query is very slow sometimes;
Claus Gittinger <cg@exept.de>
parents:
2262
diff
changeset
|
1451 |
"this updates the modifier key-states. |
581 | 1452 |
Called privately when pointer enters a view." |
1453 |
||
2312
0ec069be9679
mhmh - allButtonStates query is very slow sometimes;
Claus Gittinger <cg@exept.de>
parents:
2262
diff
changeset
|
1454 |
|state| |
0ec069be9679
mhmh - allButtonStates query is very slow sometimes;
Claus Gittinger <cg@exept.de>
parents:
2262
diff
changeset
|
1455 |
|
581 | 1456 |
"/ Prevents wrong behavior in the following scenario: |
1457 |
"/ ctrl is pressed in a view |
|
1458 |
"/ pointer is moved out of view |
|
1459 |
"/ ctrl is released |
|
1460 |
"/ pointer moved back into view |
|
1461 |
"/ popup-menu still thinks that ctrl is pressed" |
|
2312
0ec069be9679
mhmh - allButtonStates query is very slow sometimes;
Claus Gittinger <cg@exept.de>
parents:
2262
diff
changeset
|
1462 |
"/ state := aDevice buttonStates. |
0ec069be9679
mhmh - allButtonStates query is very slow sometimes;
Claus Gittinger <cg@exept.de>
parents:
2262
diff
changeset
|
1463 |
state := stateIn. |
0ec069be9679
mhmh - allButtonStates query is very slow sometimes;
Claus Gittinger <cg@exept.de>
parents:
2262
diff
changeset
|
1464 |
|
0ec069be9679
mhmh - allButtonStates query is very slow sometimes;
Claus Gittinger <cg@exept.de>
parents:
2262
diff
changeset
|
1465 |
shiftDown := (state bitAnd:(aDevice shiftMask)) ~~ 0. |
0ec069be9679
mhmh - allButtonStates query is very slow sometimes;
Claus Gittinger <cg@exept.de>
parents:
2262
diff
changeset
|
1466 |
ctrlDown := (state bitAnd:(aDevice controlMask)) ~~ 0. |
0ec069be9679
mhmh - allButtonStates query is very slow sometimes;
Claus Gittinger <cg@exept.de>
parents:
2262
diff
changeset
|
1467 |
metaDown := (state bitAnd:(aDevice metaModifierMask)) ~~ 0. |
0ec069be9679
mhmh - allButtonStates query is very slow sometimes;
Claus Gittinger <cg@exept.de>
parents:
2262
diff
changeset
|
1468 |
altDown := (state bitAnd:(aDevice altModifierMask)) ~~ 0. |
0ec069be9679
mhmh - allButtonStates query is very slow sometimes;
Claus Gittinger <cg@exept.de>
parents:
2262
diff
changeset
|
1469 |
|
0ec069be9679
mhmh - allButtonStates query is very slow sometimes;
Claus Gittinger <cg@exept.de>
parents:
2262
diff
changeset
|
1470 |
leftButtonDown := (state bitAnd:(aDevice leftButtonStateMask)) ~~ 0. |
0ec069be9679
mhmh - allButtonStates query is very slow sometimes;
Claus Gittinger <cg@exept.de>
parents:
2262
diff
changeset
|
1471 |
middleButtonDown := (state bitAnd:(aDevice middleButtonStateMask)) ~~ 0. |
0ec069be9679
mhmh - allButtonStates query is very slow sometimes;
Claus Gittinger <cg@exept.de>
parents:
2262
diff
changeset
|
1472 |
rightButtonDown := (state bitAnd:(aDevice rightButtonStateMask)) ~~ 0. |
0ec069be9679
mhmh - allButtonStates query is very slow sometimes;
Claus Gittinger <cg@exept.de>
parents:
2262
diff
changeset
|
1473 |
|
0ec069be9679
mhmh - allButtonStates query is very slow sometimes;
Claus Gittinger <cg@exept.de>
parents:
2262
diff
changeset
|
1474 |
"Created: / 27.2.1996 / 14:54:38 / cg" |
0ec069be9679
mhmh - allButtonStates query is very slow sometimes;
Claus Gittinger <cg@exept.de>
parents:
2262
diff
changeset
|
1475 |
"Modified: / 8.9.1998 / 15:11:44 / cg" |
581 | 1476 |
! ! |
1477 |
||
140 | 1478 |
!WindowSensor methodsFor:'event queue'! |
1479 |
||
144 | 1480 |
addDamage:aRectangle view:aView |
1318 | 1481 |
"{ Pragma: +optSpeed }" |
1482 |
||
0 | 1483 |
"Add aRectangle to the damage list. |
144 | 1484 |
Try to merge incoming rectangles with the existing damage rectangles. |
1485 |
Incoming rectangles which are completely contained in any existing damage rect are ignored, |
|
1486 |
any existing damage rectangle which is completely contained in the incoming rectangle |
|
152 | 1487 |
is replaced. Also, rectangles are merged into bigger ones, if they join exactly. |
144 | 1488 |
Except for special cases (moveOpaque of a view over one of my views), |
1489 |
these optimizations are not noticable." |
|
0 | 1490 |
|
751 | 1491 |
^ self addDamage:aRectangle view:aView wakeup:true |
1492 |
||
1493 |
"Modified: 28.5.1996 / 21:52:47 / cg" |
|
1494 |
! |
|
1495 |
||
1496 |
addDamage:aRectangle view:aView wakeup:doWakeup |
|
1317 | 1497 |
"{ Pragma: +optSpeed }" |
1498 |
||
751 | 1499 |
"Add aRectangle to the damage list. |
1500 |
Try to merge incoming rectangles with the existing damage rectangles. |
|
1501 |
Incoming rectangles which are completely contained in any existing damage rect are ignored, |
|
1502 |
any existing damage rectangle which is completely contained in the incoming rectangle |
|
1503 |
is replaced. Also, rectangles are merged into bigger ones, if they join exactly. |
|
1504 |
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
|
1505 |
these optimizations are not noticable. |
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1506 |
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
|
1507 |
was optimized away." |
751 | 1508 |
|
1492
cb0118ee73e3
avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents:
1412
diff
changeset
|
1509 |
|ret| |
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1510 |
|
1492
cb0118ee73e3
avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents:
1412
diff
changeset
|
1511 |
ret := false. |
2137
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
1512 |
self criticalDamageEventQueueAccess:[ |
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1513 |
(self basicAddDamage:aRectangle view:aView) |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1514 |
ifTrue:[ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1515 |
doWakeup ifTrue:[ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1516 |
self notifyEventArrival:aView. |
1492
cb0118ee73e3
avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents:
1412
diff
changeset
|
1517 |
ret := true |
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1518 |
]. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1519 |
]. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1520 |
]. |
1492
cb0118ee73e3
avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents:
1412
diff
changeset
|
1521 |
^ ret |
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1522 |
|
2137
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
1523 |
"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
|
1524 |
"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
|
1525 |
! |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1526 |
|
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1527 |
basicAddDamage:aRectangle view:aView |
1317 | 1528 |
"{ Pragma: +optSpeed }" |
1529 |
||
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1530 |
"Add aRectangle to the damage list. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1531 |
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
|
1532 |
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
|
1533 |
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
|
1534 |
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
|
1535 |
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
|
1536 |
these optimizations are not noticable. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1537 |
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
|
1538 |
was optimized away." |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1539 |
|
1616 | 1540 |
|temp index newEvent r fullRedraw |
2035
637bb684af6a
fixed ca's damage compression
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
1541 |
aDamage ev2 dRect stopSearch |
152 | 1542 |
count "{ Class: SmallInteger }" |
1543 |
sz "{ Class: SmallInteger }" |
|
1852 | 1544 |
firstInteresting |
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1545 |
lastInteresting "{ Class: SmallInteger }" |
1851
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1546 |
idx "{ Class: SmallInteger }" |
1616 | 1547 |
rL "{ Class: SmallInteger }" |
1548 |
rT "{ Class: SmallInteger }" |
|
1549 |
rB "{ Class: SmallInteger }" |
|
1550 |
rR "{ Class: SmallInteger }" |
|
1551 |
dL "{ Class: SmallInteger }" |
|
1552 |
dR "{ Class: SmallInteger }" |
|
1553 |
dT "{ Class: SmallInteger }" |
|
1554 |
dB "{ Class: SmallInteger }" |
|
1555 |
minX "{ Class: SmallInteger }" |
|
1556 |
minY "{ Class: SmallInteger }" |
|
1557 |
maxX "{ Class: SmallInteger }" |
|
1558 |
maxY "{ Class: SmallInteger }" |
|
1559 |
t "{ Class: SmallInteger }"| |
|
0 | 1560 |
|
152 | 1561 |
r := aRectangle. |
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1562 |
(fullRedraw := aView redrawsFull) ifTrue:[ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1563 |
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
|
1564 |
]. |
97f384f5e2aa
views which always redraw full may say so in #redrawsFull
Claus Gittinger <cg@exept.de>
parents:
476
diff
changeset
|
1565 |
|
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1566 |
sz := damage size. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1567 |
sz == 0 ifTrue: [ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1568 |
damage := OrderedCollection new:10. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1569 |
] ifFalse:[ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1570 |
" |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1571 |
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
|
1572 |
if so, dont add to queue |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1573 |
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
|
1574 |
" |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1575 |
fullRedraw ifTrue:[ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1576 |
firstInteresting := 1. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1577 |
lastInteresting := sz. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1578 |
] ifFalse:[ |
1851
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1579 |
count := 0. |
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1580 |
firstInteresting := nil. |
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1581 |
|
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1582 |
"/ 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
|
1583 |
"/ non-Expose (i.e. mapped/unmapped) |
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1584 |
|
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1585 |
stopSearch := false. |
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1586 |
idx := sz. |
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1587 |
[(idx > 0) and:[stopSearch not]] whileTrue:[ |
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1588 |
aDamage := damage at:idx. |
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1589 |
aDamage notNil ifTrue:[ |
2035
637bb684af6a
fixed ca's damage compression
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
1590 |
aDamage view == aView ifTrue:[ |
637bb684af6a
fixed ca's damage compression
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
1591 |
aDamage isDamage ifTrue:[ |
1851
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1592 |
((aDamage rectangle) contains:r) ifTrue:[ |
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1593 |
^ false |
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1594 |
]. |
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1595 |
count := count + 1. |
1851
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1596 |
lastInteresting := idx. |
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1597 |
firstInteresting isNil ifTrue:[ |
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1598 |
firstInteresting := idx |
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1599 |
] |
2035
637bb684af6a
fixed ca's damage compression
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
1600 |
] ifFalse:[ |
637bb684af6a
fixed ca's damage compression
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
1601 |
"/ if its a map/unmap, we can forget |
637bb684af6a
fixed ca's damage compression
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
1602 |
"/ any older damage event for this view ... |
637bb684af6a
fixed ca's damage compression
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
1603 |
(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
|
1604 |
idx := idx - 1. |
a9770eb53908
reenabled flushing of expose events before map/unmap event.
Claus Gittinger <cg@exept.de>
parents:
2058
diff
changeset
|
1605 |
[idx > 0] whileTrue:[ |
a9770eb53908
reenabled flushing of expose events before map/unmap event.
Claus Gittinger <cg@exept.de>
parents:
2058
diff
changeset
|
1606 |
ev2 := damage at:idx. |
a9770eb53908
reenabled flushing of expose events before map/unmap event.
Claus Gittinger <cg@exept.de>
parents:
2058
diff
changeset
|
1607 |
ev2 notNil ifTrue:[ |
a9770eb53908
reenabled flushing of expose events before map/unmap event.
Claus Gittinger <cg@exept.de>
parents:
2058
diff
changeset
|
1608 |
ev2 isDamage ifTrue:[ |
a9770eb53908
reenabled flushing of expose events before map/unmap event.
Claus Gittinger <cg@exept.de>
parents:
2058
diff
changeset
|
1609 |
ev2 view == aView ifTrue:[ |
a9770eb53908
reenabled flushing of expose events before map/unmap event.
Claus Gittinger <cg@exept.de>
parents:
2058
diff
changeset
|
1610 |
damage at:idx put:nil |
a9770eb53908
reenabled flushing of expose events before map/unmap event.
Claus Gittinger <cg@exept.de>
parents:
2058
diff
changeset
|
1611 |
] |
a9770eb53908
reenabled flushing of expose events before map/unmap event.
Claus Gittinger <cg@exept.de>
parents:
2058
diff
changeset
|
1612 |
] |
a9770eb53908
reenabled flushing of expose events before map/unmap event.
Claus Gittinger <cg@exept.de>
parents:
2058
diff
changeset
|
1613 |
]. |
a9770eb53908
reenabled flushing of expose events before map/unmap event.
Claus Gittinger <cg@exept.de>
parents:
2058
diff
changeset
|
1614 |
idx := idx - 1. |
a9770eb53908
reenabled flushing of expose events before map/unmap event.
Claus Gittinger <cg@exept.de>
parents:
2058
diff
changeset
|
1615 |
]. |
2035
637bb684af6a
fixed ca's damage compression
Claus Gittinger <cg@exept.de>
parents:
2022
diff
changeset
|
1616 |
stopSearch := true |
637bb684af6a
fixed ca's damage compression
Claus Gittinger <cg@exept.de>
parents:
2022
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 |
] |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1620 |
]. |
1851
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1621 |
idx := idx - 1. |
1312
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 |
]. |
46 | 1624 |
|
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1625 |
" |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1626 |
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
|
1627 |
" |
1851
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1628 |
firstInteresting notNil ifTrue:[ |
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1629 |
" |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1630 |
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
|
1631 |
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
|
1632 |
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
|
1633 |
due to the square runtime behavior (stupid algorithm ...) |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1634 |
" |
2022 | 1635 |
(fullRedraw or:[count > 10]) ifTrue:[ |
1616 | 1636 |
minX := r left. minY := r top. |
1637 |
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
|
1638 |
firstInteresting to:lastInteresting by:-1 do:[:i | |
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1639 |
aDamage := damage at:i. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1640 |
aDamage notNil ifTrue:[ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1641 |
aDamage isDamage ifTrue:[ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1642 |
(aDamage view) == aView ifTrue:[ |
1616 | 1643 |
dRect := aDamage rectangle. |
1644 |
(t := dRect left) < minX ifTrue:[minX := t]. |
|
1645 |
(t := dRect top) < minY ifTrue:[minY := t]. |
|
1646 |
(t := dRect right) > maxX ifTrue:[maxX := t]. |
|
1647 |
(t := dRect bottom) > maxY ifTrue:[maxY := t]. |
|
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1648 |
damage at:i put:nil. |
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 |
] |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1652 |
]. |
1616 | 1653 |
newEvent := WindowEvent |
1654 |
damageFor:aView |
|
1655 |
rectangle:(minX@minY corner:maxX@maxY). |
|
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1656 |
damage add:newEvent. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1657 |
^ true |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1658 |
]. |
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1659 |
|
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1660 |
" |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1661 |
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
|
1662 |
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
|
1663 |
Or, merge it with existing rectangles if possible. |
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 |
count := 0. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1666 |
rR := r right. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1667 |
rL := r left. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1668 |
rT := r top. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1669 |
rB := r bottom. |
1851
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1670 |
firstInteresting to:lastInteresting by:-1 do:[:i | |
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1671 |
aDamage := damage at:i. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1672 |
aDamage notNil ifTrue:[ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1673 |
aDamage isDamage ifTrue:[ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1674 |
(aDamage view) == aView ifTrue:[ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1675 |
dRect := aDamage rectangle. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1676 |
(r contains:dRect) ifTrue: [ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1677 |
damage at:i put:nil. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1678 |
count := count + 1 |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1679 |
] ifFalse:[ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1680 |
dL := dRect left. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1681 |
dT := dRect top. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1682 |
dR := dRect right. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1683 |
dB := dRect bottom. |
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1684 |
|
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1685 |
(rT == dT |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1686 |
and:[rB == dB]) ifTrue:[ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1687 |
(rR > dR) ifTrue: [ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1688 |
(rL <= (dR + 1)) ifTrue: [ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1689 |
dRect right:rR. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1690 |
^ false |
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 |
(rL < dL) ifTrue: [ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1694 |
(rR >= (dL - 1)) ifTrue: [ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1695 |
dRect left:rL. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1696 |
^ false |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1697 |
] |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1698 |
] |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1699 |
]. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1700 |
(rR == dR |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1701 |
and:[rL == dL]) ifTrue:[ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1702 |
(rB > dB) ifTrue: [ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1703 |
(rT <= (dB + 1)) ifTrue: [ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1704 |
dRect bottom:rB. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1705 |
^ false |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1706 |
] |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1707 |
]. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1708 |
(rT < dT) ifTrue: [ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1709 |
(rB >= (dT - 1)) ifTrue: [ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1710 |
dRect top:rT. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1711 |
^ false |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1712 |
] |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1713 |
] |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1714 |
] |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1715 |
] |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1716 |
] |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1717 |
] |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1718 |
] |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1719 |
]. |
152 | 1720 |
|
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1721 |
"/ " |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1722 |
"/ 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
|
1723 |
"/ (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
|
1724 |
"/ reorganization of the input queue) |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1725 |
"/ " |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1726 |
"/ count > 20 ifTrue: [ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1727 |
"/ temp := OrderedCollection new:(sz - count + 1). |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1728 |
"/ index := 1. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1729 |
"/ 1 to:sz do:[:idx | |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1730 |
"/ aDamage := damage at:idx. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1731 |
"/ aDamage notNil ifTrue: [ |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1732 |
"/ temp add:aDamage. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1733 |
"/ ] |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1734 |
"/ ]. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1735 |
"/ damage := temp |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1736 |
"/ ]. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1737 |
]. |
46 | 1738 |
]. |
1739 |
||
1312
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1740 |
newEvent := WindowEvent damageFor:aView rectangle:r. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1741 |
damage add:newEvent. |
92570edec99c
try again with single wakeUp (#signalIf);
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
1742 |
|
144 | 1743 |
^ true |
488
97f384f5e2aa
views which always redraw full may say so in #redrawsFull
Claus Gittinger <cg@exept.de>
parents:
476
diff
changeset
|
1744 |
|
2022 | 1745 |
"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
|
1746 |
"Modified: / 27.2.1998 / 01:49:06 / cg" |
0 | 1747 |
! |
1748 |
||
428 | 1749 |
damage |
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1750 |
"return the damage event list" |
428 | 1751 |
|
1752 |
^ damage. |
|
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1753 |
|
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1754 |
"Modified: 18.1.1997 / 14:11:08 / cg" |
428 | 1755 |
! |
1756 |
||
244 | 1757 |
nextDamage |
703
4324ab5e3630
added facility to lock expose event queue (temporary kludge ?)
Claus Gittinger <cg@exept.de>
parents:
612
diff
changeset
|
1758 |
"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
|
1759 |
or nil, if there is none. Remove it from the queue." |
244 | 1760 |
|
2437
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
1761 |
|d| |
244 | 1762 |
|
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1763 |
damage size == 0 ifTrue:[^ nil]. |
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1764 |
|
2437
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
1765 |
" |
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
1766 |
be careful: events are inserted at higher prio ... |
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
1767 |
" |
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
1768 |
self criticalDamageEventQueueAccess:[ |
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
1769 |
|foundOne| |
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
1770 |
|
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
1771 |
foundOne := false. |
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
1772 |
[foundOne] whileFalse:[ |
1492
cb0118ee73e3
avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents:
1412
diff
changeset
|
1773 |
damage size == 0 ifTrue:[ |
cb0118ee73e3
avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents:
1412
diff
changeset
|
1774 |
foundOne := true |
cb0118ee73e3
avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents:
1412
diff
changeset
|
1775 |
] ifFalse:[ |
cb0118ee73e3
avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents:
1412
diff
changeset
|
1776 |
d := damage removeFirst. |
cb0118ee73e3
avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents:
1412
diff
changeset
|
1777 |
foundOne := d notNil. |
cb0118ee73e3
avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents:
1412
diff
changeset
|
1778 |
] |
cb0118ee73e3
avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents:
1412
diff
changeset
|
1779 |
] |
244 | 1780 |
]. |
1781 |
^ d |
|
476 | 1782 |
|
2137
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
1783 |
"Modified: / 6.6.1998 / 21:10:27 / cg" |
244 | 1784 |
! |
1785 |
||
2408 | 1786 |
nextDamageEventFor:aViewOrNil |
1787 |
"retrieve the next damage event for aView (or any view if nil). |
|
1788 |
Return if there are no damage events. |
|
1789 |
Remove it from the queue." |
|
1790 |
||
2437
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
1791 |
|theEvent| |
2431
4304b047a42f
oops - damage queue grew over time (slowing down event handling)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
1792 |
|
2408 | 1793 |
damage size == 0 ifTrue:[^ nil]. |
1794 |
||
1795 |
" |
|
1796 |
be careful: events are inserted at higher prio ... |
|
1797 |
" |
|
1798 |
self criticalDamageEventQueueAccess:[ |
|
2437
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
1799 |
|anEvent idx damageSize firstNonNilIndex| |
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
1800 |
|
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
1801 |
idx := 1. |
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
1802 |
damageSize := damage size. |
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
1803 |
[idx <= damageSize] whileTrue:[ |
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
1804 |
anEvent := damage at:idx. |
2408 | 1805 |
anEvent notNil ifTrue:[ |
2431
4304b047a42f
oops - damage queue grew over time (slowing down event handling)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
1806 |
firstNonNilIndex isNil ifTrue:[ |
4304b047a42f
oops - damage queue grew over time (slowing down event handling)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
1807 |
firstNonNilIndex := idx |
4304b047a42f
oops - damage queue grew over time (slowing down event handling)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
1808 |
]. |
2408 | 1809 |
(aViewOrNil isNil or:[anEvent view == aViewOrNil]) ifTrue:[ |
1810 |
damage at:idx put:nil. |
|
2437
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
1811 |
theEvent := anEvent. |
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
1812 |
idx := damageSize. |
2408 | 1813 |
]. |
1814 |
]. |
|
2437
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
1815 |
idx := idx + 1. |
2431
4304b047a42f
oops - damage queue grew over time (slowing down event handling)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
1816 |
]. |
2439 | 1817 |
firstNonNilIndex isNil ifTrue:[ |
1818 |
damage removeAll |
|
1819 |
] ifFalse:[ |
|
1820 |
firstNonNilIndex ~~ 1 ifTrue:[ |
|
1821 |
damage removeFromIndex:1 toIndex:firstNonNilIndex |
|
2431
4304b047a42f
oops - damage queue grew over time (slowing down event handling)
Claus Gittinger <cg@exept.de>
parents:
2429
diff
changeset
|
1822 |
] |
2408 | 1823 |
] |
1824 |
]. |
|
1825 |
||
2437
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
1826 |
^ theEvent |
2408 | 1827 |
|
1828 |
"Created: / 3.12.1998 / 13:41:49 / cg" |
|
2439 | 1829 |
"Modified: / 5.2.1999 / 20:58:20 / cg" |
2408 | 1830 |
! |
1831 |
||
244 | 1832 |
nextEvent |
1833 |
"retrieve the next event or nil, if there is none. |
|
1834 |
Remove it from the queue." |
|
1835 |
||
2437
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
1836 |
|e| |
244 | 1837 |
|
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1838 |
mouseAndKeyboard size == 0 ifTrue:[^ nil]. |
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1839 |
|
2437
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
1840 |
" |
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
1841 |
be careful: events are inserted at higher prio ... |
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
1842 |
" |
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
1843 |
self criticalUserEventQueueAccess:[ |
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
1844 |
|foundOne| |
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
1845 |
|
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
1846 |
foundOne := false. |
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
1847 |
[foundOne] whileFalse:[ |
1492
cb0118ee73e3
avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents:
1412
diff
changeset
|
1848 |
mouseAndKeyboard size == 0 ifTrue:[ |
cb0118ee73e3
avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents:
1412
diff
changeset
|
1849 |
foundOne := true |
cb0118ee73e3
avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents:
1412
diff
changeset
|
1850 |
] ifFalse:[ |
cb0118ee73e3
avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents:
1412
diff
changeset
|
1851 |
e := mouseAndKeyboard removeFirst. |
cb0118ee73e3
avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents:
1412
diff
changeset
|
1852 |
foundOne := e notNil. |
cb0118ee73e3
avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents:
1412
diff
changeset
|
1853 |
] |
cb0118ee73e3
avoid returning from critical-blocks (avoid mkrealcontext calls)
Claus Gittinger <cg@exept.de>
parents:
1412
diff
changeset
|
1854 |
] |
244 | 1855 |
]. |
1856 |
^ e |
|
476 | 1857 |
|
2137
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
1858 |
"Modified: / 6.6.1998 / 21:10:39 / cg" |
244 | 1859 |
! |
1860 |
||
703
4324ab5e3630
added facility to lock expose event queue (temporary kludge ?)
Claus Gittinger <cg@exept.de>
parents:
612
diff
changeset
|
1861 |
nextExposeEventFor:aView |
1806
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1791
diff
changeset
|
1862 |
"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
|
1863 |
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
|
1864 |
Remove it from the queue." |
4324ab5e3630
added facility to lock expose event queue (temporary kludge ?)
Claus Gittinger <cg@exept.de>
parents:
612
diff
changeset
|
1865 |
|
2437
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
1866 |
|theEvent| |
2432 | 1867 |
|
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1868 |
damage size == 0 ifTrue:[^ nil]. |
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1869 |
|
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1870 |
" |
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1871 |
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
|
1872 |
" |
2137
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
1873 |
self criticalDamageEventQueueAccess:[ |
2437
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
1874 |
|firstNonNilIndex anEvent idx damageSize| |
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
1875 |
|
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
1876 |
idx := 1. |
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
1877 |
damageSize := damage size. |
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
1878 |
[idx <= damageSize] whileTrue:[ |
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
1879 |
anEvent := damage at:idx. |
1806
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1791
diff
changeset
|
1880 |
anEvent notNil ifTrue:[ |
2432 | 1881 |
firstNonNilIndex isNil ifTrue:[ |
1882 |
firstNonNilIndex := idx |
|
1883 |
]. |
|
2437
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
1884 |
|
1806
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1791
diff
changeset
|
1885 |
anEvent isDamage ifTrue:[ |
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1791
diff
changeset
|
1886 |
(aView isNil or:[anEvent view == aView]) ifTrue:[ |
2437
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
1887 |
theEvent := anEvent. |
1806
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1791
diff
changeset
|
1888 |
damage at:idx put:nil. |
2437
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
1889 |
idx := damageSize. |
1806
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1791
diff
changeset
|
1890 |
] |
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1791
diff
changeset
|
1891 |
]. |
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1791
diff
changeset
|
1892 |
]. |
2437
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
1893 |
idx := idx + 1. |
2432 | 1894 |
]. |
1895 |
||
2439 | 1896 |
firstNonNilIndex isNil ifTrue:[ |
1897 |
damage removeAll |
|
1898 |
] ifFalse:[ |
|
1899 |
firstNonNilIndex ~~ 1 ifTrue:[ |
|
1900 |
damage removeFromIndex:1 toIndex:firstNonNilIndex-1 |
|
2432 | 1901 |
] |
2437
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
1902 |
]. |
703
4324ab5e3630
added facility to lock expose event queue (temporary kludge ?)
Claus Gittinger <cg@exept.de>
parents:
612
diff
changeset
|
1903 |
]. |
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1904 |
|
2437
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
1905 |
^ theEvent |
703
4324ab5e3630
added facility to lock expose event queue (temporary kludge ?)
Claus Gittinger <cg@exept.de>
parents:
612
diff
changeset
|
1906 |
|
2137
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
1907 |
"Created: / 21.5.1996 / 17:20:54 / cg" |
2439 | 1908 |
"Modified: / 5.2.1999 / 20:58:28 / cg" |
703
4324ab5e3630
added facility to lock expose event queue (temporary kludge ?)
Claus Gittinger <cg@exept.de>
parents:
612
diff
changeset
|
1909 |
! |
4324ab5e3630
added facility to lock expose event queue (temporary kludge ?)
Claus Gittinger <cg@exept.de>
parents:
612
diff
changeset
|
1910 |
|
140 | 1911 |
pendingEvent |
152 | 1912 |
"retrieve the next pending user (i.e. non-damage) event. |
1913 |
Return nil, if there is none pending. |
|
140 | 1914 |
Do not remove it from the queue." |
47 | 1915 |
|
1063 | 1916 |
|e| |
47 | 1917 |
|
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1918 |
mouseAndKeyboard size == 0 ifTrue:[^ nil]. |
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1919 |
|
2437
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
1920 |
" |
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
1921 |
be careful: events are inserted at higher prio ... |
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
1922 |
" |
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
1923 |
self criticalUserEventQueueAccess:[ |
2058aceaed41
tuning - do not return from a valueOnOnWindDo block if possible.
Claus Gittinger <cg@exept.de>
parents:
2432
diff
changeset
|
1924 |
[e isNil] whileTrue:[ |
2137
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
1925 |
mouseAndKeyboard size == 0 ifTrue:[^ nil]. |
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
1926 |
|
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
1927 |
e := mouseAndKeyboard first. |
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
1928 |
e isNil ifTrue:[ |
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
1929 |
mouseAndKeyboard removeFirst |
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
1930 |
]. |
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
1931 |
] |
0 | 1932 |
]. |
47 | 1933 |
^ e |
476 | 1934 |
|
2137
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
1935 |
"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
|
1936 |
! |
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1937 |
|
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1938 |
pushDamageEvent:anEvent |
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1939 |
"put an event into the damage queue |
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1940 |
- this is not meant for public use" |
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1941 |
|
2137
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
1942 |
self criticalDamageEventQueueAccess:[ |
1851
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1943 |
damage addLast:anEvent. |
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1944 |
]. |
1851
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1945 |
self notifyEventArrival:anEvent view |
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1946 |
|
2137
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
1947 |
"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
|
1948 |
"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
|
1949 |
! |
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1950 |
|
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1951 |
pushEvent:anEvent |
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1952 |
"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
|
1953 |
applications and allows simulation of events |
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1954 |
(implementation of recorders & playback) |
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1955 |
or asynchronous communication between view applications |
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1956 |
(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
|
1957 |
when the target windowGroups process is rescheduled)." |
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1958 |
|
1412
c2553d477315
handle #quit event (ST-80 support)
Claus Gittinger <cg@exept.de>
parents:
1359
diff
changeset
|
1959 |
|v| |
c2553d477315
handle #quit event (ST-80 support)
Claus Gittinger <cg@exept.de>
parents:
1359
diff
changeset
|
1960 |
|
c2553d477315
handle #quit event (ST-80 support)
Claus Gittinger <cg@exept.de>
parents:
1359
diff
changeset
|
1961 |
v := anEvent view. |
2137
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
1962 |
self criticalUserEventQueueAccess:[ |
1412
c2553d477315
handle #quit event (ST-80 support)
Claus Gittinger <cg@exept.de>
parents:
1359
diff
changeset
|
1963 |
mouseAndKeyboard addLast:anEvent. |
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1964 |
]. |
1851
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1847
diff
changeset
|
1965 |
self notifyEventArrival:v |
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1966 |
|
2137
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
1967 |
"Created: / 18.9.1995 / 22:37:57 / claus" |
2157 | 1968 |
"Modified: / 18.6.1998 / 09:27:56 / cg" |
0 | 1969 |
! ! |
1970 |
||
244 | 1971 |
!WindowSensor methodsFor:'event simulation'! |
1972 |
||
1973 |
forwardKeyEventsTo:aView |
|
1974 |
"remove all keyboard events and send them to aViews sensor instead" |
|
1975 |
||
1976 |
1 to:mouseAndKeyboard size do:[:i | |
|
1271 | 1977 |
|anEvent| |
244 | 1978 |
|
1271 | 1979 |
anEvent := mouseAndKeyboard at:i. |
1980 |
anEvent notNil ifTrue:[ |
|
1981 |
anEvent isKeyEvent ifTrue:[ |
|
1982 |
anEvent view:aView. |
|
1983 |
aView sensor pushEvent:anEvent. |
|
1984 |
mouseAndKeyboard at:i put:nil |
|
1985 |
] |
|
1986 |
] |
|
244 | 1987 |
]. |
1988 |
||
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1989 |
"Modified: 18.1.1997 / 14:05:02 / cg" |
244 | 1990 |
! |
1991 |
||
1992 |
pushUserEvent:aSelector for:aView |
|
1993 |
"manually put an event into the queue - this allows |
|
1994 |
simulation of events (implementation of recorders & playback) |
|
1995 |
or asynchronous communication between view applications. |
|
1996 |
The view will perform a method as specified by aSelector, |
|
1997 |
when it performs event processing; this is different than sending |
|
1998 |
this message directly, since the execution is done by the views process, |
|
1999 |
not by the current process (which is especially worthwhile, if that method |
|
2000 |
shows a modal box or similar)." |
|
2001 |
||
2002 |
self pushUserEvent:aSelector for:aView withArguments:#() |
|
2003 |
||
2004 |
"Modified: 18.9.1995 / 22:40:12 / claus" |
|
2005 |
! |
|
2006 |
||
2007 |
pushUserEvent:aSelector for:aView withArguments:arguments |
|
2008 |
"manually put an event into the queue - this allows |
|
2009 |
simulation of events (implementation of recorders & playback) |
|
2010 |
or asynchronous communication between view applications. |
|
2011 |
The view will perform a method as specified by aSelector, |
|
2012 |
when it performs event processing; this is different than sending |
|
2013 |
this message directly, since the execution is done by the views process, |
|
2014 |
not by the current process (which is especially worthwhile, if that method |
|
2015 |
shows a modal box or similar)." |
|
2016 |
||
2017 |
self pushEvent:(WindowEvent |
|
1271 | 2018 |
for:aView |
2019 |
type:aSelector |
|
2020 |
arguments:arguments). |
|
244 | 2021 |
|
2022 |
" |
|
2023 |
|b| |
|
2024 |
b := Button label:'test'. |
|
2025 |
b open. |
|
2026 |
(Delay forSeconds:5) wait. |
|
1155
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
2027 |
b sensor pushUserEvent:#pointerEnter:x:y: for:b withArguments:#(0 1 1). |
244 | 2028 |
(Delay forSeconds:1) wait. |
1155
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
2029 |
b sensor pushUserEvent:#buttonPress:x:y: for:b withArguments:#(1 1 1). |
244 | 2030 |
(Delay forSeconds:2) wait. |
1155
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
2031 |
b sensor pushUserEvent:#buttonRelease:x:y: for:b withArguments:#(1 1 1). |
244 | 2032 |
(Delay forSeconds:1) wait. |
1155
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
2033 |
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
|
2034 |
" |
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
2035 |
|
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
2036 |
" |
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
2037 |
|b| |
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
2038 |
b := Button label:'test'. |
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
2039 |
b open. |
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
2040 |
(Delay forSeconds:5) wait. |
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
2041 |
b sensor pushUserEvent:#fooBar for:b withArguments:#(). |
244 | 2042 |
" |
1155
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
2043 |
|
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
2044 |
" |
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
2045 |
|b| |
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
2046 |
b := Button label:'test'. |
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
2047 |
b open. |
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
2048 |
(Delay forSeconds:3) wait. |
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
2049 |
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
|
2050 |
" |
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
2051 |
|
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
2052 |
"Modified: 4.1.1997 / 13:53:01 / cg" |
244 | 2053 |
! ! |
2054 |
||
2055 |
!WindowSensor methodsFor:'initialization'! |
|
2056 |
||
2057 |
initialize |
|
2058 |
"initialize the event queues to empty" |
|
2059 |
||
2137
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
2060 |
damageEventAccessLock := Semaphore forMutualExclusion. |
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
2061 |
damageEventAccessLock name:'WSensor ev-q damageEventAccessLock'. |
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
2062 |
userEventAccessLock := Semaphore forMutualExclusion. |
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
2063 |
userEventAccessLock name:'WSensor ev-q userEventAccessLock'. |
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
2064 |
|
244 | 2065 |
damage := OrderedCollection new. |
2066 |
mouseAndKeyboard := OrderedCollection new. |
|
1295
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
2067 |
|
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
2068 |
gotExpose := IdentitySet new. |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
2069 |
catchExpose := IdentitySet new. |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
2070 |
gotOtherEvent := IdentitySet new. |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
2071 |
exposeEventSemaphore := Semaphore new name:'WSensor exposeSema'. |
244 | 2072 |
|
2073 |
compressMotionEvents := translateKeyboardEvents := true. |
|
2074 |
ignoreUserInput := false. |
|
2075 |
shiftDown := ctrlDown := altDown := metaDown := false. |
|
2076 |
leftButtonDown := middleButtonDown := rightButtonDown := false. |
|
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
2077 |
|
2137
cec979de294c
now use two semaphores (one for each queue).
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
2078 |
"Modified: / 6.6.1998 / 21:14:49 / cg" |
244 | 2079 |
! |
2080 |
||
2081 |
reinitialize |
|
2082 |
"called when an image is restarted; |
|
2083 |
reinitialize the event queues to empty; leave other setup as-is" |
|
2084 |
||
2085 |
self flushUserEvents. |
|
2086 |
self flushExposeEvents. |
|
1295
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
2087 |
|
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
2088 |
gotExpose := IdentitySet new. |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
2089 |
catchExpose := IdentitySet new. |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
2090 |
gotOtherEvent := IdentitySet new. |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
2091 |
exposeEventSemaphore := Semaphore new name:'WSensor exposeSema'. |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
2092 |
|
244 | 2093 |
shiftDown := ctrlDown := altDown := metaDown := false. |
2094 |
leftButtonDown := middleButtonDown := rightButtonDown := false. |
|
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
2095 |
|
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
2096 |
"Modified: 18.1.1997 / 15:30:23 / cg" |
244 | 2097 |
! ! |
2098 |
||
1100 | 2099 |
!WindowSensor methodsFor:'queries - event queue'! |
2100 |
||
2085 | 2101 |
damageCount |
2102 |
"return the number of pending damage events (i.e. expose or resize)" |
|
2103 |
||
2104 |
^ damage size |
|
2105 |
||
2106 |
"Modified: / 2.4.1997 / 14:14:01 / cg" |
|
2107 |
"Created: / 5.4.1998 / 11:35:04 / cg" |
|
2108 |
! |
|
2109 |
||
1100 | 2110 |
eventPending |
2111 |
"return true, if either damage or events are pending" |
|
2112 |
||
2113 |
mouseAndKeyboard size ~~ 0 ifTrue:[^ true]. |
|
2114 |
^ damage size ~~ 0 |
|
2115 |
! |
|
2116 |
||
2117 |
hasButtonEventFor:aView |
|
2118 |
"return true, if any button events are pending. |
|
2119 |
If the argument, aView is nil, the information is regarding any |
|
2120 |
view (i.e. is there a button event for any of my views); |
|
1505 | 2121 |
otherwise, the information is regarding that specific view." |
1100 | 2122 |
|
2123 |
(self hasButtonMotionEventFor:aView) ifTrue:[^ true]. |
|
2124 |
(self hasButtonPressEventFor:aView) ifTrue:[^ true]. |
|
2125 |
^ (self hasButtonReleaseEventFor:aView) |
|
2126 |
||
2127 |
"Created: 1.11.1996 / 17:02:23 / cg" |
|
2128 |
"Modified: 1.11.1996 / 17:12:03 / cg" |
|
2129 |
! |
|
2130 |
||
2131 |
hasButtonMotionEventFor:aView |
|
2132 |
"return true, if any buttonMotion events are pending. |
|
2133 |
If the argument, aView is nil, the information is regarding any |
|
2134 |
view (i.e. is there a motion event for any of my views); |
|
1505 | 2135 |
otherwise, the information is regarding that specific view." |
1100 | 2136 |
|
2137 |
^ self hasEvent:#buttonMotion:x:y: orPendingDeviceEvent:#buttonMotion for:aView |
|
2138 |
||
2139 |
"Created: 1.11.1996 / 17:04:01 / cg" |
|
2140 |
! |
|
2141 |
||
2142 |
hasButtonPressEventFor:aView |
|
2143 |
"return true, if any buttonPress events are pending. |
|
2144 |
If the argument, aView is nil, the information is regarding any |
|
2145 |
view (i.e. is there a buttonPress event for any of my views); |
|
1505 | 2146 |
otherwise, the information is regarding that specific view." |
1100 | 2147 |
|
2148 |
^ self hasEvent:#buttonPress:x:y: orPendingDeviceEvent:#buttonPress for:aView |
|
2149 |
||
2150 |
"Created: 1.11.1996 / 17:05:10 / cg" |
|
2151 |
"Modified: 1.11.1996 / 17:11:09 / cg" |
|
2152 |
! |
|
2153 |
||
2154 |
hasButtonReleaseEventFor:aView |
|
2155 |
"return true, if any buttonRelease events are pending. |
|
2156 |
If the argument, aView is nil, the information is regarding any |
|
2157 |
view (i.e. is there a buttonrelease event for any of my views); |
|
1505 | 2158 |
otherwise, the information is regarding that specific view." |
1100 | 2159 |
|
2160 |
^ self hasEvent:#buttonRelease:x:y: orPendingDeviceEvent:#buttonRelease for:aView |
|
2161 |
||
2162 |
"Created: 1.11.1996 / 17:05:26 / cg" |
|
2163 |
"Modified: 1.11.1996 / 17:11:18 / cg" |
|
2164 |
! |
|
2165 |
||
2166 |
hasConfigureEventFor:aView |
|
2167 |
"return true, if any resize/position events are pending. |
|
2168 |
If the argument, aView is nil, the information is regarding any |
|
2169 |
view (i.e. is there a configure event for any of my views); |
|
1505 | 2170 |
otherwise, the information is regarding that specific view." |
1100 | 2171 |
|
2172 |
^ self hasEvent:#configureX:y:width:height: orPendingDeviceEvent:#structureNotify for:aView |
|
2173 |
||
2174 |
"Modified: 1.11.1996 / 17:11:27 / cg" |
|
2175 |
! |
|
2176 |
||
2177 |
hasDamage |
|
1512 | 2178 |
"return true, if any damage events (i.e. expose or resize) are pending. |
2179 |
Since this is often invoked by ST-80 classes to poll the sensor, |
|
2180 |
a yield is done here to avoid a busy wait blocking other processes." |
|
2181 |
||
2182 |
Processor yield. |
|
1100 | 2183 |
^ damage size ~~ 0 |
2184 |
||
1512 | 2185 |
"Modified: 2.4.1997 / 14:14:01 / cg" |
1100 | 2186 |
! |
2187 |
||
2188 |
hasDamageFor:aView |
|
2189 |
"return true, if any damage events (i.e. expose or resize) |
|
2190 |
are pending for aView" |
|
2191 |
||
2192 |
damage size ~~ 0 ifTrue:[ |
|
1271 | 2193 |
damage do:[:aDamage | |
2194 |
aDamage notNil ifTrue:[ |
|
2195 |
aDamage view == aView ifTrue:[^ true]. |
|
2196 |
]. |
|
2197 |
] |
|
1100 | 2198 |
]. |
2199 |
^ false |
|
2200 |
||
2201 |
"Modified: 21.5.1996 / 17:15:09 / cg" |
|
2202 |
! |
|
2203 |
||
2144
c3bd3dfe592a
another event pending query added
Claus Gittinger <cg@exept.de>
parents:
2141
diff
changeset
|
2204 |
hasEvent:type for:aView |
c3bd3dfe592a
another event pending query added
Claus Gittinger <cg@exept.de>
parents:
2141
diff
changeset
|
2205 |
"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
|
2206 |
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
|
2207 |
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
|
2208 |
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
|
2209 |
otherwise, the information is regarding to that specific view." |
c3bd3dfe592a
another event pending query added
Claus Gittinger <cg@exept.de>
parents:
2141
diff
changeset
|
2210 |
|
c3bd3dfe592a
another event pending query added
Claus Gittinger <cg@exept.de>
parents:
2141
diff
changeset
|
2211 |
mouseAndKeyboard size ~~ 0 ifTrue:[ |
c3bd3dfe592a
another event pending query added
Claus Gittinger <cg@exept.de>
parents:
2141
diff
changeset
|
2212 |
mouseAndKeyboard do:[:anEvent | |
c3bd3dfe592a
another event pending query added
Claus Gittinger <cg@exept.de>
parents:
2141
diff
changeset
|
2213 |
anEvent notNil ifTrue:[ |
c3bd3dfe592a
another event pending query added
Claus Gittinger <cg@exept.de>
parents:
2141
diff
changeset
|
2214 |
(aView isNil or:[anEvent view == aView]) ifTrue:[ |
2157 | 2215 |
(type isNil or:[anEvent type == type]) ifTrue:[^ true]. |
2144
c3bd3dfe592a
another event pending query added
Claus Gittinger <cg@exept.de>
parents:
2141
diff
changeset
|
2216 |
] |
c3bd3dfe592a
another event pending query added
Claus Gittinger <cg@exept.de>
parents:
2141
diff
changeset
|
2217 |
]. |
c3bd3dfe592a
another event pending query added
Claus Gittinger <cg@exept.de>
parents:
2141
diff
changeset
|
2218 |
] |
c3bd3dfe592a
another event pending query added
Claus Gittinger <cg@exept.de>
parents:
2141
diff
changeset
|
2219 |
]. |
c3bd3dfe592a
another event pending query added
Claus Gittinger <cg@exept.de>
parents:
2141
diff
changeset
|
2220 |
damage size ~~ 0 ifTrue:[ |
c3bd3dfe592a
another event pending query added
Claus Gittinger <cg@exept.de>
parents:
2141
diff
changeset
|
2221 |
damage do:[:anEvent | |
c3bd3dfe592a
another event pending query added
Claus Gittinger <cg@exept.de>
parents:
2141
diff
changeset
|
2222 |
anEvent notNil ifTrue:[ |
c3bd3dfe592a
another event pending query added
Claus Gittinger <cg@exept.de>
parents:
2141
diff
changeset
|
2223 |
(aView isNil or:[anEvent view == aView]) ifTrue:[ |
2157 | 2224 |
(type isNil or:[anEvent type == type]) ifTrue:[^ true]. |
2144
c3bd3dfe592a
another event pending query added
Claus Gittinger <cg@exept.de>
parents:
2141
diff
changeset
|
2225 |
] |
c3bd3dfe592a
another event pending query added
Claus Gittinger <cg@exept.de>
parents:
2141
diff
changeset
|
2226 |
]. |
c3bd3dfe592a
another event pending query added
Claus Gittinger <cg@exept.de>
parents:
2141
diff
changeset
|
2227 |
] |
c3bd3dfe592a
another event pending query added
Claus Gittinger <cg@exept.de>
parents:
2141
diff
changeset
|
2228 |
]. |
c3bd3dfe592a
another event pending query added
Claus Gittinger <cg@exept.de>
parents:
2141
diff
changeset
|
2229 |
^ false |
c3bd3dfe592a
another event pending query added
Claus Gittinger <cg@exept.de>
parents:
2141
diff
changeset
|
2230 |
|
c3bd3dfe592a
another event pending query added
Claus Gittinger <cg@exept.de>
parents:
2141
diff
changeset
|
2231 |
"Created: / 10.6.1998 / 17:33:46 / cg" |
2157 | 2232 |
"Modified: / 18.6.1998 / 09:29:18 / cg" |
2144
c3bd3dfe592a
another event pending query added
Claus Gittinger <cg@exept.de>
parents:
2141
diff
changeset
|
2233 |
! |
c3bd3dfe592a
another event pending query added
Claus Gittinger <cg@exept.de>
parents:
2141
diff
changeset
|
2234 |
|
1155
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
2235 |
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
|
2236 |
"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
|
2237 |
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
|
2238 |
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
|
2239 |
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
|
2240 |
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
|
2241 |
|
1505 | 2242 |
^ self |
2243 |
hasEvent:type |
|
2244 |
for:aView |
|
2245 |
withMatchingArguments:[:evArgs | evArgs = args] |
|
2246 |
! |
|
2247 |
||
2248 |
hasEvent:type for:aView withMatchingArguments:argMatchBlock |
|
2249 |
"return true, if a matching event is pending in my queues. |
|
2250 |
Type is the type of event, matchBlock is a block which gets the event args |
|
2251 |
and should return true. |
|
2252 |
If the argument, aView is nil, the information is regarding any |
|
2253 |
view (i.e. is there an event for any of my views); |
|
2254 |
otherwise, the information is regarding to that specific view." |
|
2255 |
||
1155
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
2256 |
mouseAndKeyboard size ~~ 0 ifTrue:[ |
1505 | 2257 |
mouseAndKeyboard do:[:anEvent | |
2258 |
anEvent notNil ifTrue:[ |
|
2259 |
(aView isNil or:[anEvent view == aView]) ifTrue:[ |
|
2260 |
anEvent type == type ifTrue:[ |
|
2261 |
(argMatchBlock value:anEvent arguments) ifTrue:[ |
|
2262 |
^ true |
|
2263 |
]. |
|
2264 |
] |
|
2265 |
] |
|
2266 |
]. |
|
2267 |
] |
|
1155
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
2268 |
]. |
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
2269 |
damage size ~~ 0 ifTrue:[ |
1505 | 2270 |
damage do:[:anEvent | |
2271 |
anEvent notNil ifTrue:[ |
|
2272 |
(aView isNil or:[anEvent view == aView]) ifTrue:[ |
|
2273 |
anEvent type == type ifTrue:[ |
|
2274 |
(argMatchBlock value:anEvent arguments) ifTrue:[ |
|
2275 |
^ true |
|
2276 |
] |
|
2277 |
]. |
|
2278 |
] |
|
2279 |
]. |
|
2280 |
] |
|
1155
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
2281 |
]. |
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
2282 |
^ false |
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
2283 |
|
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
2284 |
"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
|
2285 |
"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
|
2286 |
! |
e8b6f0e8484e
added query for event with args for view pending
Claus Gittinger <cg@exept.de>
parents:
1108
diff
changeset
|
2287 |
|
1100 | 2288 |
hasEvent:type orPendingDeviceEvent:dType for:aView |
2144
c3bd3dfe592a
another event pending query added
Claus Gittinger <cg@exept.de>
parents:
2141
diff
changeset
|
2289 |
"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
|
2290 |
or in the devices event queue. |
1100 | 2291 |
Type is the type of event, dType the corresponding device event. |
2292 |
If the argument, aView is nil, the information is regarding any |
|
2293 |
view (i.e. is there an event for any of my views); |
|
2294 |
otherwise, the information is regarding to that specific view." |
|
2295 |
||
2144
c3bd3dfe592a
another event pending query added
Claus Gittinger <cg@exept.de>
parents:
2141
diff
changeset
|
2296 |
"/ look in my queues |
c3bd3dfe592a
another event pending query added
Claus Gittinger <cg@exept.de>
parents:
2141
diff
changeset
|
2297 |
(self hasEvent:type for:aView) ifTrue:[^ true]. |
c3bd3dfe592a
another event pending query added
Claus Gittinger <cg@exept.de>
parents:
2141
diff
changeset
|
2298 |
|
1100 | 2299 |
aView notNil ifTrue:[ |
2144
c3bd3dfe592a
another event pending query added
Claus Gittinger <cg@exept.de>
parents:
2141
diff
changeset
|
2300 |
"/ ask the device if it has something pending |
c3bd3dfe592a
another event pending query added
Claus Gittinger <cg@exept.de>
parents:
2141
diff
changeset
|
2301 |
^ aView graphicsDevice eventPending:dType for:aView id |
1100 | 2302 |
]. |
2303 |
^ false |
|
2304 |
||
2144
c3bd3dfe592a
another event pending query added
Claus Gittinger <cg@exept.de>
parents:
2141
diff
changeset
|
2305 |
"Modified: / 10.6.1998 / 17:34:51 / cg" |
1100 | 2306 |
! |
2307 |
||
2308 |
hasEvents |
|
2309 |
"return true, if any mouse/keyboard events are pending" |
|
2310 |
||
2441 | 2311 |
mouseAndKeyboard size ~~ 0 ifTrue:[^ true]. |
2312 |
^ damage size ~~ 0 |
|
2313 |
||
2314 |
"Modified: / 5.2.1999 / 22:30:23 / cg" |
|
1100 | 2315 |
! |
2316 |
||
2317 |
hasExposeEventFor:aView |
|
2318 |
"return true, if any exposure events are pending for aView" |
|
2319 |
||
2320 |
damage size ~~ 0 ifTrue:[ |
|
1271 | 2321 |
damage do:[:aDamage | |
2322 |
aDamage notNil ifTrue:[ |
|
2323 |
aDamage isDamage ifTrue:[ |
|
2324 |
(aView isNil |
|
2325 |
or:[aDamage view == aView]) ifTrue:[^ true]. |
|
2326 |
] |
|
2327 |
]. |
|
2328 |
] |
|
1100 | 2329 |
]. |
2330 |
^ false |
|
2331 |
||
2332 |
"Modified: 21.5.1996 / 17:13:09 / cg" |
|
2333 |
"Created: 1.11.1996 / 17:05:41 / cg" |
|
2334 |
! |
|
2335 |
||
2336 |
hasKeyEventFor:aView |
|
2337 |
"return true, if any key (press or release) events are pending. |
|
2338 |
If the argument, aView is nil, the information is regarding any |
|
2339 |
view (i.e. is there a key event for any of my views); |
|
1505 | 2340 |
otherwise, the information is regarding that specific view." |
1100 | 2341 |
|
2342 |
(self hasKeyPressEventFor:aView) ifTrue:[^ true]. |
|
2343 |
^ self hasKeyReleaseEventFor:aView |
|
2344 |
||
2345 |
"Created: 1.11.1996 / 17:08:03 / cg" |
|
2346 |
"Modified: 1.11.1996 / 17:11:55 / cg" |
|
2347 |
! |
|
2348 |
||
2349 |
hasKeyPressEventFor:aView |
|
2350 |
"return true, if any keyPress events are pending. |
|
2351 |
If the argument, aView is nil, the information is regarding any |
|
2352 |
view (i.e. is there a keyPress event for any of my views); |
|
1505 | 2353 |
otherwise, the information is regarding that specific view." |
1100 | 2354 |
|
2355 |
^ self hasEvent:#keyPress:x:y: orPendingDeviceEvent:#keyPress for:aView |
|
2356 |
||
2357 |
"Created: 1.11.1996 / 17:05:58 / cg" |
|
2358 |
"Modified: 1.11.1996 / 17:12:10 / cg" |
|
2359 |
! |
|
2360 |
||
2361 |
hasKeyReleaseEventFor:aView |
|
2362 |
"return true, if any keyRelease events are pending. |
|
2363 |
If the argument, aView is nil, the information is regarding any |
|
2364 |
view (i.e. is there a keyRelease event for any of my views); |
|
1505 | 2365 |
otherwise, the information is regarding that specific view." |
1100 | 2366 |
|
2367 |
^ self hasEvent:#keyRelease:x:y: orPendingDeviceEvent:#keyRelease for:aView |
|
2368 |
||
2369 |
"Created: 1.11.1996 / 17:06:34 / cg" |
|
2370 |
"Modified: 1.11.1996 / 17:12:15 / cg" |
|
2371 |
! |
|
2372 |
||
2157 | 2373 |
hasUserEvent:type for:aView |
2374 |
"return true, if a specific event is pending in my user event queue. |
|
2375 |
Type is the type of event, dType the corresponding device event. |
|
2376 |
If the argument, aView is nil, the information is regarding any |
|
2377 |
view (i.e. is there an event for any of my views); |
|
2378 |
otherwise, the information is regarding to that specific view." |
|
2379 |
||
2380 |
mouseAndKeyboard size ~~ 0 ifTrue:[ |
|
2381 |
mouseAndKeyboard do:[:anEvent | |
|
2382 |
anEvent notNil ifTrue:[ |
|
2383 |
(aView isNil or:[anEvent view == aView]) ifTrue:[ |
|
2384 |
(type isNil or:[anEvent type == type]) ifTrue:[^ true]. |
|
2385 |
] |
|
2386 |
]. |
|
2387 |
] |
|
2388 |
]. |
|
2389 |
^ false |
|
2390 |
||
2391 |
"Created: / 17.6.1998 / 12:55:54 / cg" |
|
2392 |
"Modified: / 18.6.1998 / 08:57:00 / cg" |
|
2393 |
! |
|
2394 |
||
1100 | 2395 |
hasUserEventFor:aView |
2396 |
"return true, if any user event (i.e. key or button events) are pending. |
|
2397 |
If the argument, aView is nil, the information is regarding any |
|
2398 |
view (i.e. is there a user event for any of my views); |
|
1505 | 2399 |
otherwise, the information is regarding that specific view." |
1100 | 2400 |
|
2401 |
(self hasKeyEventFor:aView) ifTrue:[^ true]. |
|
2402 |
^ (self hasButtonEventFor:aView) |
|
2403 |
||
2404 |
"Created: 1.11.1996 / 17:08:50 / cg" |
|
2405 |
"Modified: 1.11.1996 / 17:12:21 / cg" |
|
2406 |
! |
|
2407 |
||
2441 | 2408 |
hasUserEvents |
2409 |
"return true, if any mouse/keyboard events are pending" |
|
2410 |
||
2411 |
^ mouseAndKeyboard size ~~ 0 |
|
2412 |
||
2413 |
"Created: / 5.2.1999 / 22:29:11 / cg" |
|
2414 |
! |
|
2415 |
||
1100 | 2416 |
motionEventPending |
2417 |
"return true, if any buttonMotion events are pending." |
|
2418 |
||
2419 |
^ self hasButtonMotionEventFor:nil |
|
2420 |
||
2421 |
"Created: 24.3.1996 / 20:09:55 / cg" |
|
2422 |
"Modified: 1.11.1996 / 17:04:43 / cg" |
|
2177 | 2423 |
! |
2424 |
||
2425 |
userEventCount |
|
2426 |
"return the number of pending user events" |
|
2427 |
||
2428 |
^ mouseAndKeyboard size |
|
2429 |
||
2430 |
"Modified: / 21.7.1998 / 18:52:19 / cg" |
|
2431 |
"Created: / 21.7.1998 / 19:36:04 / cg" |
|
1100 | 2432 |
! ! |
2433 |
||
2434 |
!WindowSensor methodsFor:'queries - key & button state'! |
|
140 | 2435 |
|
244 | 2436 |
altDown |
2437 |
"return true, if the meta key is currently pressed. |
|
2438 |
Notice, that some keyboards dont have an alt key; |
|
2439 |
it is better to use 'sensor metaDown or:[sensor altDown]'." |
|
2440 |
||
2441 |
^ altDown |
|
2442 |
! |
|
2443 |
||
2444 |
anyButtonPressed |
|
2445 |
"ST-80 compatibility: return true, if any mouse button is pressed. |
|
2446 |
You should no use it in 'normal' applications. |
|
2447 |
Instead, keep track of the buttons state in your views or controllers |
|
2448 |
button-event methods." |
|
2449 |
||
1083
6e947cc67324
fixed #anyButtonPressed & setting of buttonDown-flags
Claus Gittinger <cg@exept.de>
parents:
1082
diff
changeset
|
2450 |
^ leftButtonDown or:[middleButtonDown or:[rightButtonDown]] |
6e947cc67324
fixed #anyButtonPressed & setting of buttonDown-flags
Claus Gittinger <cg@exept.de>
parents:
1082
diff
changeset
|
2451 |
|
6e947cc67324
fixed #anyButtonPressed & setting of buttonDown-flags
Claus Gittinger <cg@exept.de>
parents:
1082
diff
changeset
|
2452 |
"Modified: 21.10.1996 / 11:37:31 / cg" |
244 | 2453 |
! |
2454 |
||
2455 |
blueButtonPressed |
|
2456 |
"ST-80 compatibility: return true, if the right mouse button is pressed. |
|
2457 |
You should no use it in 'normal' applications. |
|
2458 |
Instead, keep track of the buttons state in your views or controllers |
|
2459 |
button-event methods." |
|
2460 |
||
2461 |
^ rightButtonDown |
|
2462 |
! |
|
2463 |
||
2464 |
ctrlDown |
|
2465 |
"return true, if any CTRL key is currently pressed." |
|
2466 |
||
2467 |
^ ctrlDown |
|
2468 |
! |
|
2469 |
||
157 | 2470 |
leftButtonPressed |
2471 |
"return true, if the left mouse button is pressed. |
|
2472 |
This has been added to support ST-80 style button polling; |
|
2473 |
however, you should no use it in 'normal' applications. |
|
2474 |
Instead, keep track of the buttons state in your views or controllers |
|
2475 |
button-event methods." |
|
2476 |
||
2477 |
^ leftButtonDown |
|
2478 |
! |
|
2479 |
||
244 | 2480 |
metaDown |
2481 |
"return true, if the meta key is currently pressed. |
|
2482 |
Notice, that most keyboards dont have a meta key; |
|
2483 |
it is better to use 'sensor metaDown or:[sensor altDown]'." |
|
2484 |
||
2485 |
^ metaDown |
|
2486 |
! |
|
2487 |
||
157 | 2488 |
middleButtonPressed |
2489 |
"return true, if the middle mouse button is pressed. |
|
2490 |
This has been added to support ST-80 style button polling; |
|
2491 |
however, you should no use it in 'normal' applications. |
|
2492 |
Instead, keep track of the buttons state in your views or controllers |
|
2493 |
button-event methods." |
|
2494 |
||
2495 |
^ middleButtonDown |
|
2496 |
! |
|
2497 |
||
244 | 2498 |
redButtonPressed |
2499 |
"ST-80 compatibility: return true, if the left mouse button is pressed. |
|
2500 |
You should no use it in 'normal' applications. |
|
2501 |
Instead, keep track of the buttons state in your views or controllers |
|
2502 |
button-event methods." |
|
2503 |
||
2504 |
^ leftButtonDown |
|
2505 |
! |
|
2506 |
||
157 | 2507 |
rightButtonPressed |
2508 |
"return true, if the right mouse button is pressed. |
|
2509 |
This has been added to support ST-80 style button polling; |
|
2510 |
however, you should no use it in 'normal' applications. |
|
2511 |
Instead, keep track of the buttons state in your views or controllers |
|
2512 |
button-event methods." |
|
2513 |
||
2514 |
^ rightButtonDown |
|
2515 |
! |
|
2516 |
||
244 | 2517 |
shiftDown |
2518 |
"return true, if any shift key is currently pressed." |
|
157 | 2519 |
|
244 | 2520 |
^ shiftDown |
157 | 2521 |
! |
2522 |
||
2523 |
yellowButtonPressed |
|
2524 |
"ST-80 compatibility: return true, if the middle mouse button is pressed. |
|
2525 |
You should no use it in 'normal' applications. |
|
2526 |
Instead, keep track of the buttons state in your views or controllers |
|
2527 |
button-event methods." |
|
2528 |
||
2529 |
^ middleButtonDown |
|
140 | 2530 |
! ! |
2531 |
||
1100 | 2532 |
!WindowSensor methodsFor:'queries - pointer'! |
2533 |
||
2534 |
cursorPoint |
|
2535 |
"ST-80 compatibility: |
|
2536 |
return the position of the mouse pointer on the current display |
|
2537 |
(in screen coordinates)" |
|
2538 |
||
2539 |
^ self class cursorPoint |
|
2540 |
! |
|
2541 |
||
2542 |
globalOrigin |
|
2543 |
"ST-80 compatibility: |
|
2544 |
dont know what we should return here ... |
|
2545 |
... at least the PD program which uses it works when we return 0@0." |
|
2546 |
||
2547 |
^ 0@0 |
|
2548 |
! |
|
2549 |
||
2550 |
mousePoint |
|
2551 |
"ST-80 compatibility: |
|
2552 |
return the position of the mouse pointer on the current display |
|
2553 |
(in screen coordinates)" |
|
2554 |
||
2555 |
^ self cursorPoint |
|
2556 |
! ! |
|
2557 |
||
26 | 2558 |
!WindowSensor methodsFor:'special'! |
2559 |
||
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
2560 |
catchExposeFor:aView |
54 | 2561 |
"start catching noExpose events (must be done BEFORE a bitblt, |
2562 |
to prepare for the exposeEventSemaphore to be signalled when |
|
2563 |
the noExpose event arrives)." |
|
26 | 2564 |
|
1295
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
2565 |
"/ this is only needed for X ... |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
2566 |
aView device scrollsAsynchronous ifFalse:[ |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
2567 |
^ self |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
2568 |
]. |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
2569 |
|
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
2570 |
(catchExpose includes:aView) ifTrue:[ |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
2571 |
('WSensor [warning]: already catching (for ' , aView printString , ')') errorPrintCR. |
1274 | 2572 |
Delay waitForMilliseconds:100. |
1295
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
2573 |
(catchExpose includes:aView) ifTrue:[ |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
2574 |
('WSensor [warning]: still catching (for ' , aView printString , ')') errorPrintCR. |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
2575 |
"/ wake the other one |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
2576 |
gotExpose add:aView. |
1274 | 2577 |
exposeEventSemaphore signalForAll. |
1295
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
2578 |
Delay waitForMilliseconds:100. |
1274 | 2579 |
]. |
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
2580 |
]. |
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
2581 |
|
1295
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
2582 |
[ |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
2583 |
gotOtherEvent remove:aView ifAbsent:nil. |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
2584 |
gotExpose remove:aView ifAbsent:nil. |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
2585 |
catchExpose add:aView. |
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
2586 |
] valueUninterruptably. |
28 | 2587 |
! |
2588 |
||
1320 | 2589 |
pollForActivity |
1529 | 2590 |
"ST-80 compatibility: wait for some activity (i.e. poll for an event) " |
1320 | 2591 |
|
2592 |
"/ should add a buttonStateChangeSemaphore and wait on this ... |
|
1529 | 2593 |
"/ Delay waitForSeconds:0.01. |
2594 |
Processor yield. |
|
2595 |
||
2596 |
"Modified: 12.2.1997 / 12:46:09 / cg" |
|
1320 | 2597 |
! |
2598 |
||
244 | 2599 |
waitButton |
2600 |
"ST-80 compatibility: wait until any mouse button is pressed. |
|
2601 |
Do not use this in your applications; polling the sensor is |
|
2602 |
bad style." |
|
2603 |
||
2604 |
[self anyButtonPressed] whileFalse:[ |
|
1320 | 2605 |
self pollForActivity |
244 | 2606 |
]. |
2607 |
||
1320 | 2608 |
"Modified: 10.2.1997 / 13:30:38 / cg" |
2609 |
! |
|
2610 |
||
2611 |
waitClickButton |
|
2612 |
"ST-80 compatibility: wait until any mouse button is pressed & released again. |
|
2613 |
Do not use this in your applications; polling the sensor is |
|
2614 |
bad style." |
|
2615 |
||
1790
a7f42261ab45
need a RecursionLock for the accessLock to avoid
Claus Gittinger <cg@exept.de>
parents:
1734
diff
changeset
|
2616 |
self waitButton. |
1320 | 2617 |
^self waitNoButton |
2618 |
||
2619 |
"Created: 10.2.1997 / 13:31:09 / cg" |
|
244 | 2620 |
! |
2621 |
||
26 | 2622 |
waitForExposeFor:aView |
157 | 2623 |
"wait until a graphicsExpose or a noExpose arrives (after a bitblt). |
2624 |
This may be too X-specific, and things may change in this area |
|
2625 |
in future versions. (or the new device may simulate the arrival of |
|
2626 |
such an event)" |
|
54 | 2627 |
|
2421 | 2628 |
|blocked lostExpose device stopPoll endPollTime pollDelay| |
1873
a67649816bc8
break non-windowGroup expose-poll loop after a while (10 seconds)
Claus Gittinger <cg@exept.de>
parents:
1864
diff
changeset
|
2629 |
|
a67649816bc8
break non-windowGroup expose-poll loop after a while (10 seconds)
Claus Gittinger <cg@exept.de>
parents:
1864
diff
changeset
|
2630 |
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
|
2631 |
|
1295
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
2632 |
"/ 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
|
2633 |
device scrollsAsynchronous ifFalse:[ |
a67649816bc8
break non-windowGroup expose-poll loop after a while (10 seconds)
Claus Gittinger <cg@exept.de>
parents:
1864
diff
changeset
|
2634 |
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
|
2635 |
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
|
2636 |
^ self |
1027
0ba82862ca8d
fixes for synchronous scrolling (WINDOWS)
Claus Gittinger <cg@exept.de>
parents:
1013
diff
changeset
|
2637 |
]. |
0ba82862ca8d
fixes for synchronous scrolling (WINDOWS)
Claus Gittinger <cg@exept.de>
parents:
1013
diff
changeset
|
2638 |
|
1359
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2639 |
blocked := true. |
1013
32d804ff472d
cleanup when unwinding from a waitForExpose
Claus Gittinger <cg@exept.de>
parents:
1012
diff
changeset
|
2640 |
[ |
1359
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2641 |
aView flush. |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2642 |
Processor activeProcessIsSystemProcess ifTrue:[ |
2421 | 2643 |
device platformName = 'WIN32' ifTrue:[ |
2644 |
pollDelay := 1. |
|
2645 |
] ifFalse:[ |
|
2646 |
pollDelay := 3. |
|
2647 |
]. |
|
2648 |
endPollTime := AbsoluteTime now addSeconds:pollDelay. |
|
1873
a67649816bc8
break non-windowGroup expose-poll loop after a while (10 seconds)
Claus Gittinger <cg@exept.de>
parents:
1864
diff
changeset
|
2649 |
stopPoll := false. |
a67649816bc8
break non-windowGroup expose-poll loop after a while (10 seconds)
Claus Gittinger <cg@exept.de>
parents:
1864
diff
changeset
|
2650 |
|
a67649816bc8
break non-windowGroup expose-poll loop after a while (10 seconds)
Claus Gittinger <cg@exept.de>
parents:
1864
diff
changeset
|
2651 |
"/ |
a67649816bc8
break non-windowGroup expose-poll loop after a while (10 seconds)
Claus Gittinger <cg@exept.de>
parents:
1864
diff
changeset
|
2652 |
"/ 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
|
2653 |
"/ 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
|
2654 |
"/ |
a67649816bc8
break non-windowGroup expose-poll loop after a while (10 seconds)
Claus Gittinger <cg@exept.de>
parents:
1864
diff
changeset
|
2655 |
[(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
|
2656 |
(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
|
2657 |
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
|
2658 |
]. |
a67649816bc8
break non-windowGroup expose-poll loop after a while (10 seconds)
Claus Gittinger <cg@exept.de>
parents:
1864
diff
changeset
|
2659 |
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
|
2660 |
Processor yield. |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2661 |
] |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2662 |
] ifFalse:[ |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2663 |
lostExpose := 1. |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2664 |
" |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2665 |
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
|
2666 |
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
|
2667 |
with #signalForAll. |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2668 |
" |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2669 |
blocked := OperatingSystem blockInterrupts. |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2670 |
[ (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
|
2671 |
" |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2672 |
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
|
2673 |
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
|
2674 |
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
|
2675 |
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
|
2676 |
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
|
2677 |
" |
1505 | 2678 |
(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
|
2679 |
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
|
2680 |
lostExpose == 1 ifTrue:[ |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2681 |
" |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2682 |
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
|
2683 |
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
|
2684 |
" |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2685 |
('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
|
2686 |
] ifFalse:[ |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2687 |
'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
|
2688 |
]. |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2689 |
lostExpose := lostExpose + 1. |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2690 |
]. |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2691 |
]. |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2692 |
]. |
1013
32d804ff472d
cleanup when unwinding from a waitForExpose
Claus Gittinger <cg@exept.de>
parents:
1012
diff
changeset
|
2693 |
] valueNowOrOnUnwindDo:[ |
1359
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2694 |
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
|
2695 |
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
|
2696 |
blocked ifFalse:[ |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2697 |
OperatingSystem unblockInterrupts. |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2698 |
]. |
1295
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1274
diff
changeset
|
2699 |
|
1359
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2700 |
"/ |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2701 |
"/ 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
|
2702 |
"/ Now handle those ... |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2703 |
"/ |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2704 |
(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
|
2705 |
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
|
2706 |
]. |
ab88659a5000
Fix race in #waitForExposeFor: which could cause a "late expose event"
Stefan Vogel <sv@exept.de>
parents:
1340
diff
changeset
|
2707 |
eventSemaphore signalOnce |
1013
32d804ff472d
cleanup when unwinding from a waitForExpose
Claus Gittinger <cg@exept.de>
parents:
1012
diff
changeset
|
2708 |
]. |
26 | 2709 |
|
2421 | 2710 |
"Modified: / 20.2.1997 / 09:24:31 / stefan" |
2711 |
"Modified: / 9.1.1999 / 01:58:56 / cg" |
|
47 | 2712 |
! |
2713 |
||
157 | 2714 |
waitNoButton |
2715 |
"ST-80 compatibility: wait until no mouse button is pressed. |
|
2716 |
Do not use this in your applications; polling the sensor is |
|
2717 |
bad style." |
|
2718 |
||
2719 |
[self anyButtonPressed] whileTrue:[ |
|
1320 | 2720 |
self pollForActivity |
157 | 2721 |
]. |
1241
c65f1c9d8de4
use critical regions around queue manipulation code.
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
2722 |
|
1320 | 2723 |
"Modified: 10.2.1997 / 13:30:43 / cg" |
157 | 2724 |
! ! |
2725 |
||
1082 | 2726 |
!WindowSensor class methodsFor:'documentation'! |
251 | 2727 |
|
2728 |
version |
|
2441 | 2729 |
^ '$Header: /cvs/stx/stx/libview/Attic/WSensor.st,v 1.142 1999-02-08 14:24:17 cg Exp $' |
251 | 2730 |
! ! |
140 | 2731 |
WindowSensor initialize! |