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