EvMonitor.st
author Claus Gittinger <cg@exept.de>
Sat, 05 Apr 1997 01:24:17 +0200
changeset 1117 6fa462d56e64
parent 1053 9b1b15ef1e34
child 1822 b0fb61c02717
permissions -rw-r--r--
checkin from browser

"
 COPYRIGHT (c) 1991 by Claus Gittinger
	      All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"

StandardSystemView subclass:#EventMonitor
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'Monitors-ST/X'
!

!EventMonitor class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 1991 by Claus Gittinger
	      All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
!

documentation
"
    like xev - show events.
    You can use this to check your keyboard mappings, for example.
    start with: 
	EventMonitor open
    and watch the output on xterm.
"
! !

!EventMonitor class methodsFor:'defaults'!

defaultExtent
    ^ 200 @ 200
!

defaultLabel
    ^ 'Event Monitor'
! !

!EventMonitor methodsFor:'events'!

buttonMotion:state x:x y:y
    'buttonMotion x:' print. x print. ' y:' print. y print.
    ' state:' print. state printCR

    "Modified: 5.4.1997 / 01:23:39 / cg"
!

buttonPress:button x:x y:y
    'buttonPress x:' print. x print. ' y:' print. y print.
    ' button:' print. button printCR

    "Modified: 5.4.1997 / 01:23:42 / cg"
!

buttonRelease:button x:x y:y
    'buttonRelease x:' print. x print. ' y:' print. y print.
    ' button:' print. button printCR

    "Modified: 5.4.1997 / 01:23:43 / cg"
!

configureX:x y:y width:newWidth height:newHeight
    'configure x:' print. x print. ' y:' print. y print.
    ' width:' print. newWidth print. ' height:' print. newHeight printCR.

    ^ super configureX:x y:y width:newWidth height:newHeight

    "Modified: 5.4.1997 / 01:23:45 / cg"
!

dropMessage:dropType data:dropData
    'drop: ' print. dropType print. ' data:' print. dropData printCR.

    "Modified: 5.4.1997 / 01:23:28 / cg"
!

focusIn
    'focusIn' printCR.

    "Created: 7.3.1996 / 15:06:18 / cg"
    "Modified: 5.4.1997 / 01:23:48 / cg"
!

focusOut
    'focusOut' printCR.

    "Created: 7.3.1996 / 15:06:21 / cg"
    "Modified: 5.4.1997 / 01:23:49 / cg"
!

keyPress:key x:x y:y
    |untranslatedKey|

    'KeyPress x:' print. x print. ' y:' print. y print.
    (key isMemberOf:Character) ifTrue:[
        ' character key:' print. key print.
        ' (' print. key asciiValue print. ')' print
    ] ifFalse:[
        ' symbolic key:' print. key storeString print.
        untranslatedKey := device keyboardMap keyAtValue:key ifAbsent:key.
        untranslatedKey ~~ key ifTrue:[
            ' untranslated key:' print. untranslatedKey print
        ]
    ].

    '' printCR
!

keyRelease:key x:x y:y
    |untranslatedKey|

    'KeyRelease x:' print. x print. ' y:' print. y print.
    (key isMemberOf:Character) ifTrue:[
        ' character key:' print. key print.
        ' (' print. key asciiValue print. ')' print
    ] ifFalse:[
        ' symbolic key:' print. key storeString print.
        untranslatedKey := device keyboardMap keyAtValue:key ifAbsent:key.
        untranslatedKey ~~ key ifTrue:[
            ' untranslated key:' print. untranslatedKey print
        ]
    ].

    '' printCR
!

mapped
    'mapped' printCR

    "Modified: 5.4.1997 / 01:24:00 / cg"
!

pointerEnter:state x:x y:y
    'pointerEnter x:' print. x print. ' y:' print. y print.
    ' state:' print. state printCR

    "Modified: 5.4.1997 / 01:24:02 / cg"
!

pointerLeave:state 
    'pointerLeave state:' print. state printCR

    "Modified: 5.4.1997 / 01:24:05 / cg"
!

unmapped
    'unmapped' printCR

    "Modified: 5.4.1997 / 01:24:09 / cg"
!

visibilityChange:how
    'visibilityChange:' print. how storeString printCR

    "Modified: 5.4.1997 / 01:24:07 / cg"
! !

!EventMonitor methodsFor:'initialization'!

initialize
    |l|

    super initialize.

    l := Label label:'see event trace\on standard output' withCRs in:self.
    l borderWidth:0
! !

!EventMonitor methodsFor:'realization'!

initEvents
    self enableMotionEvents.
    self enableKeyReleaseEvents.
    self enableEnterLeaveEvents.
    self enableFocusEvents.
    self enableEvent:#visibilityChange

    "Modified: 7.3.1996 / 15:06:42 / cg"
! !

!EventMonitor class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libtool/Attic/EvMonitor.st,v 1.16 1997-04-04 23:24:17 cg Exp $'
! !