[squeak-dev] VM side EventSensor design questions

Michael van der Gulik mikevdg at gmail.com
Wed Jun 24 02:06:45 UTC 2009


Hi all.

I'm writing my own EventSensor class (as part of Subcanvas:
http://gulik.pbwiki.com/Canvas) and I'm looking at what the VM is doing.

When I press and release key under a recent Linux VM, I get three events:

#(2 512613 53 1 8 0 0 0)
#(2 512613 53 0 8 0 0 0)
#(2 512664 53 2 8 0 0 0)

The fields are (for those that don't already know this):

1: type (2=keyboard),
2: timestamp,
3: character in Mac Roman encoding,
4: key press/release (0=character, 1=press, 2=release)
5: modifiers (1=shift, 2=ctrl, 4=mac option, 8=cmd/alt)

and the rest of the fields are unused afaict.

Now, why do I get both a key pressed event and a character event? The key
pressed event already has the character information. Is there a circumstance
where these two events would differ in anything other than the type of
event?

The VM doesn't send any events for only a shift/ctrl/alt key press or
release. Should it?

If you hold down a key, you get a stream of key press and character events
for the same key. Should it? I'd prefer to have character repetition handled
within the image so that arcade games could be implemented.

Finally, I'm lazy, so I'm going to ask this mailing list how Unicode input
has been handled rather than read code. Do implementations modify the VM to
send Unicode characters through as field 3 (or whatever) of the input
arrays? Or do the implementations take the Mac Roman encoding from the event
array, look up a keyboard mapping in the image and convert the result to the
correct Unicode character?

Gulik.

-- 
http://gulik.pbwiki.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20090624/9d8d4e1d/attachment.htm


More information about the Squeak-dev mailing list