author | Claus Gittinger <cg@exept.de> |
Tue, 15 Aug 2000 16:19:12 +0200 | |
changeset 2699 | dcb83b594b14 |
parent 2159 | 591bf0fa03a9 |
child 2805 | 9fb350d5fef0 |
permissions | -rw-r--r-- |
52 | 1 |
" |
2 |
COPYRIGHT (c) 1991 by Claus Gittinger |
|
3 |
All Rights Reserved |
|
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 |
" |
|
12 |
||
19 | 13 |
StandardSystemView subclass:#EventMonitor |
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
14 |
instanceVariableNames:'' |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
15 |
classVariableNames:'' |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
16 |
poolDictionaries:'' |
1053 | 17 |
category:'Monitors-ST/X' |
19 | 18 |
! |
19 |
||
1021 | 20 |
!EventMonitor class methodsFor:'documentation'! |
52 | 21 |
|
22 |
copyright |
|
23 |
" |
|
24 |
COPYRIGHT (c) 1991 by Claus Gittinger |
|
25 |
All Rights Reserved |
|
19 | 26 |
|
52 | 27 |
This software is furnished under a license and may be used |
28 |
only in accordance with the terms of that license and with the |
|
29 |
inclusion of the above copyright notice. This software may not |
|
30 |
be provided or otherwise made available to, or used by, any |
|
31 |
other person. No title to or ownership of the software is |
|
32 |
hereby transferred. |
|
33 |
" |
|
34 |
! |
|
35 |
||
36 |
documentation |
|
37 |
" |
|
38 |
like xev - show events. |
|
39 |
You can use this to check your keyboard mappings, for example. |
|
40 |
start with: |
|
41 |
EventMonitor open |
|
53 | 42 |
and watch the output on xterm. |
52 | 43 |
" |
44 |
! ! |
|
19 | 45 |
|
1021 | 46 |
!EventMonitor class methodsFor:'defaults'! |
19 | 47 |
|
48 |
defaultExtent |
|
49 |
^ 200 @ 200 |
|
50 |
! |
|
51 |
||
52 |
defaultLabel |
|
53 |
^ 'Event Monitor' |
|
54 |
! ! |
|
55 |
||
1822 | 56 |
!EventMonitor class methodsFor:'startup'! |
57 |
||
58 |
isVisualStartable |
|
59 |
^ true |
|
60 |
||
61 |
"Created: / 10.8.1998 / 16:03:13 / cg" |
|
62 |
! ! |
|
63 |
||
19 | 64 |
!EventMonitor methodsFor:'events'! |
65 |
||
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
66 |
buttonMotion:state x:x y:y |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
67 |
'buttonMotion x:' print. x print. ' y:' print. y print. |
1117 | 68 |
' state:' print. state printCR |
69 |
||
70 |
"Modified: 5.4.1997 / 01:23:39 / cg" |
|
19 | 71 |
! |
72 |
||
2159 | 73 |
buttonMultiPress:button x:x y:y |
74 |
'buttonMultiPress x:' print. x print. ' y:' print. y print. |
|
75 |
' button:' print. button printCR |
|
76 |
||
77 |
"Modified: / 5.4.1997 / 01:23:42 / cg" |
|
78 |
"Created: / 19.5.1999 / 09:40:40 / cg" |
|
79 |
! |
|
80 |
||
19 | 81 |
buttonPress:button x:x y:y |
82 |
'buttonPress x:' print. x print. ' y:' print. y print. |
|
1117 | 83 |
' button:' print. button printCR |
84 |
||
85 |
"Modified: 5.4.1997 / 01:23:42 / cg" |
|
19 | 86 |
! |
87 |
||
88 |
buttonRelease:button x:x y:y |
|
89 |
'buttonRelease x:' print. x print. ' y:' print. y print. |
|
1117 | 90 |
' button:' print. button printCR |
91 |
||
92 |
"Modified: 5.4.1997 / 01:23:43 / cg" |
|
19 | 93 |
! |
94 |
||
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
95 |
configureX:x y:y width:newWidth height:newHeight |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
96 |
'configure x:' print. x print. ' y:' print. y print. |
1117 | 97 |
' width:' print. newWidth print. ' height:' print. newHeight printCR. |
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
98 |
|
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
99 |
^ super configureX:x y:y width:newWidth height:newHeight |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
100 |
|
1117 | 101 |
"Modified: 5.4.1997 / 01:23:45 / cg" |
102 |
! |
|
103 |
||
104 |
dropMessage:dropType data:dropData |
|
105 |
'drop: ' print. dropType print. ' data:' print. dropData printCR. |
|
106 |
||
107 |
"Modified: 5.4.1997 / 01:23:28 / cg" |
|
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
108 |
! |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
109 |
|
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
110 |
focusIn |
1117 | 111 |
'focusIn' printCR. |
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
112 |
|
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
113 |
"Created: 7.3.1996 / 15:06:18 / cg" |
1117 | 114 |
"Modified: 5.4.1997 / 01:23:48 / cg" |
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
115 |
! |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
116 |
|
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
117 |
focusOut |
1117 | 118 |
'focusOut' printCR. |
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
119 |
|
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
120 |
"Created: 7.3.1996 / 15:06:21 / cg" |
1117 | 121 |
"Modified: 5.4.1997 / 01:23:49 / cg" |
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
122 |
! |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
123 |
|
2159 | 124 |
hasKeyboardFocus:aBoolen |
125 |
'hasKeyboardFocus:' print. aBoolen printCR |
|
126 |
||
127 |
"Modified: / 19.5.1999 / 09:42:59 / cg" |
|
128 |
! |
|
129 |
||
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
130 |
keyPress:key x:x y:y |
640
7608b07af7bb
show untranslated key as well
Claus Gittinger <cg@exept.de>
parents:
433
diff
changeset
|
131 |
|untranslatedKey| |
7608b07af7bb
show untranslated key as well
Claus Gittinger <cg@exept.de>
parents:
433
diff
changeset
|
132 |
|
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
133 |
'KeyPress x:' print. x print. ' y:' print. y print. |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
134 |
(key isMemberOf:Character) ifTrue:[ |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
135 |
' character key:' print. key print. |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
136 |
' (' print. key asciiValue print. ')' print |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
137 |
] ifFalse:[ |
640
7608b07af7bb
show untranslated key as well
Claus Gittinger <cg@exept.de>
parents:
433
diff
changeset
|
138 |
' symbolic key:' print. key storeString print. |
7608b07af7bb
show untranslated key as well
Claus Gittinger <cg@exept.de>
parents:
433
diff
changeset
|
139 |
untranslatedKey := device keyboardMap keyAtValue:key ifAbsent:key. |
7608b07af7bb
show untranslated key as well
Claus Gittinger <cg@exept.de>
parents:
433
diff
changeset
|
140 |
untranslatedKey ~~ key ifTrue:[ |
7608b07af7bb
show untranslated key as well
Claus Gittinger <cg@exept.de>
parents:
433
diff
changeset
|
141 |
' untranslated key:' print. untranslatedKey print |
7608b07af7bb
show untranslated key as well
Claus Gittinger <cg@exept.de>
parents:
433
diff
changeset
|
142 |
] |
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
143 |
]. |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
144 |
|
640
7608b07af7bb
show untranslated key as well
Claus Gittinger <cg@exept.de>
parents:
433
diff
changeset
|
145 |
'' printCR |
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
146 |
! |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
147 |
|
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
148 |
keyRelease:key x:x y:y |
640
7608b07af7bb
show untranslated key as well
Claus Gittinger <cg@exept.de>
parents:
433
diff
changeset
|
149 |
|untranslatedKey| |
7608b07af7bb
show untranslated key as well
Claus Gittinger <cg@exept.de>
parents:
433
diff
changeset
|
150 |
|
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
151 |
'KeyRelease x:' print. x print. ' y:' print. y print. |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
152 |
(key isMemberOf:Character) ifTrue:[ |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
153 |
' character key:' print. key print. |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
154 |
' (' print. key asciiValue print. ')' print |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
155 |
] ifFalse:[ |
640
7608b07af7bb
show untranslated key as well
Claus Gittinger <cg@exept.de>
parents:
433
diff
changeset
|
156 |
' symbolic key:' print. key storeString print. |
7608b07af7bb
show untranslated key as well
Claus Gittinger <cg@exept.de>
parents:
433
diff
changeset
|
157 |
untranslatedKey := device keyboardMap keyAtValue:key ifAbsent:key. |
7608b07af7bb
show untranslated key as well
Claus Gittinger <cg@exept.de>
parents:
433
diff
changeset
|
158 |
untranslatedKey ~~ key ifTrue:[ |
7608b07af7bb
show untranslated key as well
Claus Gittinger <cg@exept.de>
parents:
433
diff
changeset
|
159 |
' untranslated key:' print. untranslatedKey print |
7608b07af7bb
show untranslated key as well
Claus Gittinger <cg@exept.de>
parents:
433
diff
changeset
|
160 |
] |
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
161 |
]. |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
162 |
|
640
7608b07af7bb
show untranslated key as well
Claus Gittinger <cg@exept.de>
parents:
433
diff
changeset
|
163 |
'' printCR |
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
164 |
! |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
165 |
|
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
166 |
mapped |
1977 | 167 |
'mapped' printCR. |
168 |
super mapped. |
|
1117 | 169 |
|
1977 | 170 |
"Modified: / 6.1.1999 / 11:04:32 / cg" |
45 | 171 |
! |
172 |
||
52 | 173 |
pointerEnter:state x:x y:y |
174 |
'pointerEnter x:' print. x print. ' y:' print. y print. |
|
1117 | 175 |
' state:' print. state printCR |
176 |
||
177 |
"Modified: 5.4.1997 / 01:24:02 / cg" |
|
52 | 178 |
! |
179 |
||
180 |
pointerLeave:state |
|
1117 | 181 |
'pointerLeave state:' print. state printCR |
182 |
||
183 |
"Modified: 5.4.1997 / 01:24:05 / cg" |
|
52 | 184 |
! |
185 |
||
45 | 186 |
unmapped |
1977 | 187 |
'unmapped' printCR. |
188 |
super unmapped. |
|
1117 | 189 |
|
1977 | 190 |
"Modified: / 6.1.1999 / 11:04:22 / cg" |
45 | 191 |
! |
192 |
||
193 |
visibilityChange:how |
|
1977 | 194 |
'visibilityChange:' print. how storeString printCR. |
195 |
super visibilityChange:how |
|
1117 | 196 |
|
1977 | 197 |
"Modified: / 6.1.1999 / 11:04:12 / cg" |
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
198 |
! ! |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
199 |
|
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
200 |
!EventMonitor methodsFor:'initialization'! |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
201 |
|
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
202 |
initialize |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
203 |
|l| |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
204 |
|
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
205 |
super initialize. |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
206 |
|
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
207 |
l := Label label:'see event trace\on standard output' withCRs in:self. |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
208 |
l borderWidth:0 |
19 | 209 |
! ! |
210 |
||
211 |
!EventMonitor methodsFor:'realization'! |
|
212 |
||
213 |
initEvents |
|
214 |
self enableMotionEvents. |
|
45 | 215 |
self enableKeyReleaseEvents. |
52 | 216 |
self enableEnterLeaveEvents. |
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
217 |
self enableFocusEvents. |
45 | 218 |
self enableEvent:#visibilityChange |
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
219 |
|
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
220 |
"Modified: 7.3.1996 / 15:06:42 / cg" |
19 | 221 |
! ! |
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
222 |
|
1021 | 223 |
!EventMonitor class methodsFor:'documentation'! |
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
224 |
|
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
225 |
version |
2159 | 226 |
^ '$Header: /cvs/stx/stx/libtool/EventMonitor.st,v 1.19 1999-05-19 08:47:51 cg Exp $' |
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
227 |
! ! |