author | Claus Gittinger <cg@exept.de> |
Thu, 07 Jan 1999 14:37:53 +0100 | |
changeset 1977 | 0ff4d80c7f32 |
parent 1822 | b0fb61c02717 |
child 2159 | 591bf0fa03a9 |
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 |
||
73 |
buttonPress:button x:x y:y |
|
74 |
'buttonPress x:' print. x print. ' y:' print. y print. |
|
1117 | 75 |
' button:' print. button printCR |
76 |
||
77 |
"Modified: 5.4.1997 / 01:23:42 / cg" |
|
19 | 78 |
! |
79 |
||
80 |
buttonRelease:button x:x y:y |
|
81 |
'buttonRelease x:' print. x print. ' y:' print. y print. |
|
1117 | 82 |
' button:' print. button printCR |
83 |
||
84 |
"Modified: 5.4.1997 / 01:23:43 / cg" |
|
19 | 85 |
! |
86 |
||
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
87 |
configureX:x y:y width:newWidth height:newHeight |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
88 |
'configure x:' print. x print. ' y:' print. y print. |
1117 | 89 |
' width:' print. newWidth print. ' height:' print. newHeight printCR. |
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
90 |
|
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
91 |
^ super configureX:x y:y width:newWidth height:newHeight |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
92 |
|
1117 | 93 |
"Modified: 5.4.1997 / 01:23:45 / cg" |
94 |
! |
|
95 |
||
96 |
dropMessage:dropType data:dropData |
|
97 |
'drop: ' print. dropType print. ' data:' print. dropData printCR. |
|
98 |
||
99 |
"Modified: 5.4.1997 / 01:23:28 / cg" |
|
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 |
|
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
102 |
focusIn |
1117 | 103 |
'focusIn' printCR. |
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
104 |
|
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
105 |
"Created: 7.3.1996 / 15:06:18 / cg" |
1117 | 106 |
"Modified: 5.4.1997 / 01:23:48 / cg" |
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
107 |
! |
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 |
focusOut |
1117 | 110 |
'focusOut' printCR. |
433
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 |
"Created: 7.3.1996 / 15:06:21 / cg" |
1117 | 113 |
"Modified: 5.4.1997 / 01:23:49 / cg" |
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 |
|
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
116 |
keyPress:key x:x y:y |
640
7608b07af7bb
show untranslated key as well
Claus Gittinger <cg@exept.de>
parents:
433
diff
changeset
|
117 |
|untranslatedKey| |
7608b07af7bb
show untranslated key as well
Claus Gittinger <cg@exept.de>
parents:
433
diff
changeset
|
118 |
|
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
119 |
'KeyPress x:' print. x print. ' y:' print. y print. |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
120 |
(key isMemberOf:Character) ifTrue:[ |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
121 |
' character key:' print. key print. |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
122 |
' (' print. key asciiValue print. ')' print |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
123 |
] ifFalse:[ |
640
7608b07af7bb
show untranslated key as well
Claus Gittinger <cg@exept.de>
parents:
433
diff
changeset
|
124 |
' symbolic key:' print. key storeString print. |
7608b07af7bb
show untranslated key as well
Claus Gittinger <cg@exept.de>
parents:
433
diff
changeset
|
125 |
untranslatedKey := device keyboardMap keyAtValue:key ifAbsent:key. |
7608b07af7bb
show untranslated key as well
Claus Gittinger <cg@exept.de>
parents:
433
diff
changeset
|
126 |
untranslatedKey ~~ key ifTrue:[ |
7608b07af7bb
show untranslated key as well
Claus Gittinger <cg@exept.de>
parents:
433
diff
changeset
|
127 |
' untranslated key:' print. untranslatedKey print |
7608b07af7bb
show untranslated key as well
Claus Gittinger <cg@exept.de>
parents:
433
diff
changeset
|
128 |
] |
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
129 |
]. |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
130 |
|
640
7608b07af7bb
show untranslated key as well
Claus Gittinger <cg@exept.de>
parents:
433
diff
changeset
|
131 |
'' printCR |
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
132 |
! |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
133 |
|
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
134 |
keyRelease:key x:x y:y |
640
7608b07af7bb
show untranslated key as well
Claus Gittinger <cg@exept.de>
parents:
433
diff
changeset
|
135 |
|untranslatedKey| |
7608b07af7bb
show untranslated key as well
Claus Gittinger <cg@exept.de>
parents:
433
diff
changeset
|
136 |
|
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
137 |
'KeyRelease x:' print. x print. ' y:' print. y print. |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
138 |
(key isMemberOf:Character) ifTrue:[ |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
139 |
' character key:' print. key print. |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
140 |
' (' print. key asciiValue print. ')' print |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
141 |
] ifFalse:[ |
640
7608b07af7bb
show untranslated key as well
Claus Gittinger <cg@exept.de>
parents:
433
diff
changeset
|
142 |
' symbolic key:' print. key storeString print. |
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:[ |
7608b07af7bb
show untranslated key as well
Claus Gittinger <cg@exept.de>
parents:
433
diff
changeset
|
145 |
' untranslated key:' print. untranslatedKey print |
7608b07af7bb
show untranslated key as well
Claus Gittinger <cg@exept.de>
parents:
433
diff
changeset
|
146 |
] |
433
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 |
|
640
7608b07af7bb
show untranslated key as well
Claus Gittinger <cg@exept.de>
parents:
433
diff
changeset
|
149 |
'' printCR |
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 |
mapped |
1977 | 153 |
'mapped' printCR. |
154 |
super mapped. |
|
1117 | 155 |
|
1977 | 156 |
"Modified: / 6.1.1999 / 11:04:32 / cg" |
45 | 157 |
! |
158 |
||
52 | 159 |
pointerEnter:state x:x y:y |
160 |
'pointerEnter x:' print. x print. ' y:' print. y print. |
|
1117 | 161 |
' state:' print. state printCR |
162 |
||
163 |
"Modified: 5.4.1997 / 01:24:02 / cg" |
|
52 | 164 |
! |
165 |
||
166 |
pointerLeave:state |
|
1117 | 167 |
'pointerLeave state:' print. state printCR |
168 |
||
169 |
"Modified: 5.4.1997 / 01:24:05 / cg" |
|
52 | 170 |
! |
171 |
||
45 | 172 |
unmapped |
1977 | 173 |
'unmapped' printCR. |
174 |
super unmapped. |
|
1117 | 175 |
|
1977 | 176 |
"Modified: / 6.1.1999 / 11:04:22 / cg" |
45 | 177 |
! |
178 |
||
179 |
visibilityChange:how |
|
1977 | 180 |
'visibilityChange:' print. how storeString printCR. |
181 |
super visibilityChange:how |
|
1117 | 182 |
|
1977 | 183 |
"Modified: / 6.1.1999 / 11:04:12 / cg" |
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
184 |
! ! |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
185 |
|
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
186 |
!EventMonitor methodsFor:'initialization'! |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
187 |
|
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
188 |
initialize |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
189 |
|l| |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
190 |
|
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
191 |
super initialize. |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
192 |
|
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
193 |
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
|
194 |
l borderWidth:0 |
19 | 195 |
! ! |
196 |
||
197 |
!EventMonitor methodsFor:'realization'! |
|
198 |
||
199 |
initEvents |
|
200 |
self enableMotionEvents. |
|
45 | 201 |
self enableKeyReleaseEvents. |
52 | 202 |
self enableEnterLeaveEvents. |
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
203 |
self enableFocusEvents. |
45 | 204 |
self enableEvent:#visibilityChange |
433
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 |
"Modified: 7.3.1996 / 15:06:42 / cg" |
19 | 207 |
! ! |
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
208 |
|
1021 | 209 |
!EventMonitor class methodsFor:'documentation'! |
433
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 |
version |
1977 | 212 |
^ '$Header: /cvs/stx/stx/libtool/EventMonitor.st,v 1.18 1999-01-07 13:36:59 cg Exp $' |
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
213 |
! ! |