[squeak-dev] VM side EventSensor design questions

John McIntosh johnmci at smalltalkconsulting.com
Wed Jun 24 03:06:41 UTC 2009


Everything you want to know is documented here
http://isqueak.org/ioGetNextEvent

but I might have missed something or things have changed since last fall

On Tuesday, June 23, 2009, Michael van der Gulik <mikevdg at gmail.com> wrote:
> 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/
>

-- 
===========================================================================
John M. McIntosh <johnmci at smalltalkconsulting.com>
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
===========================================================================



More information about the Squeak-dev mailing list