*"Event handling, and the philosopher's keyboard"* I've downloaded Stef and Igor's EventModel to play with their new event model :). I've created KeydownEvent and KeyupEvent in contrast to the generic KeyboardEvent with all the information. It's very simple code, but, that is the api I'm talking about. Gofer it squeaksource: 'GuilleUtils'; package: 'EventModel'; load | ann evt | ann := SystemInputEventAnnouncer new. ann subscribe: SystemInputEvent send: #dispatchEvent: to: World activeHand. 10 timesRepeat: [ 500 milliSeconds asDelay wait. evt := Sensor nextEvent. evt ifNotNil: [ ann handleEvent: evt ]. ]. I don't know what other people happen to think about it :/, but a simple path to include this stuff in the image without breaking everything should be: 1) since keyup and keydown events are not used in any morph in the core, adding the new keydown and keyup should not break anything. 2) fetch a #keyStroke: implementor 3) if it's handling shortcuts instead of only chars (like cmd+smthg, ctrl+smthng), create an issue "put my shortcut handling in #keyDown: please" 4) solve the issue 5) if (#keyStrokes: toRefactor) > 0 : goto 2 After all that, the keyStroke users should only be using keyCharacter, and the refactor to use a simplified KeystrokeEvent is pretty straight forward :). On Thu, Jan 26, 2012 at 3:07 PM, Guillermo Polito <guillermopolito@gmail.com
wrote:
2) Some key representation varies from platform to platform. i.e.: A Shift-only press generates today a keydown event with: - a 254 keyCode value in unix - a 16 keyCode value in windows
So I think a "table" has to be built and documented for mappings for each key in a keyboard. Examples of this can be found in enums/defs from other platforms:
X11 (current used window system in unix vm): http://cgit.freedesktop.org/xorg/proto/x11proto/plain/keysymdef.h
Andreas Raab suggested here to follow the X11 table, since it seems to be the more complete one :): http://forum.world.st/Windows-cog-vm-Keyboard-events-related-about-keycode-m... Guille