[Vm-dev] SqueakVM help for OLPC

John M McIntosh johnmci at smalltalkconsulting.com
Tue May 15 19:48:17 UTC 2007


Well I think the unicode value has been in there in the mac vm since  
march of  2002.

Andreas suggested

	Proposal: utf32Code in sqKeyboardEvent
	Date: 	March 18, 2005 11:41:12 PM PST (CA)

> Folks,
>
> Since I'm not sure all of you have followed the discussion about  
> scroll events (which then went into keyboard events) here's my  
> proposal again: I would like to add a utf32Code field to  
> sqKeyboardEvent which serves the purpose to provide a UTF-32 value  
> if the VM provides extended input services (the Mac VM already  
> does; others will surely follow). The utf32Code field only needs to  
> be filled in for EventKeyChar events (e.g., neither for  
> EventKeyDown or EventKeyUp since those are used for reporting keys  
> not characters).
>
> John is already playing with this but I want to make sure there is  
> general agreement on this issue. Ian, Tim? Any extra comments?
>
> Cheers,
>   - Andreas
>

I could be wrong but after this discussion  utf32Code was never used  
by the Windows VM, well other than setting it to zero?

However in working with Sophie we found some shortcoming, and I had  
suggest this change (below) but was told Windows doesn't support it.


Subject: 	sq.h changes, grabbed reserved field in sqKeyboardEvent
	Date: 	March 29, 2006 1:59:49 PM PST (CA)


> In our work with Sophie we became aware of a shortcoming in how  
> keyboard events are created and what data they contain
> and what data is needed to transform keyboard command on various  
> obscure European keyboards into meaningful interactions
> within Tweak and other important applications like Sophie.
>
> In the past on the macintosh and we believe on Windows the data  
> coming up as a result of
> a keystroke was
>
> key down
> charCode:  	a magic number mapping to a key on the keyboard,  
> different between mac/windows
> pressCode:	0
>
> key char
> charCode	the macroman value of the key pressed
> pressCode	the utf-32 value of the key pressed
>
> key up
> charCode:  	a magic number mapping to a key on the keyboard,  
> different between mac/windows
> pressCode:	0
>

The suggestion was:

> Now the results will be.
>
> key down
> charCode:  	a magic number mapping to a key on the keyboard,  
> different between mac/windows
> pressCode	the utf-32 value of the key pressed
> additionalData	the macroman value of the key pressed
>
> key char
> charCode	the macroman value of the key pressed
> pressCode	the utf-32 value of the key pressed
> additionalData	a magic number mapping to a key on the keyboard,  
> different between mac/windows
>
>
> key up
> charCode:  	a magic number mapping to a key on the keyboard,  
> different between mac/windows
> pressCode	the utf-32 value of the key pressed
> additionalData	the macroman value of the key pressed
>
>
> This preserves the existing behaviour, but adds the ability to  
> better support non-usa keyboards and character sets.
> I will make this change btw weekend baring a more elegant solution.
>
> /* keyboard input event */
> typedef struct sqKeyboardEvent
> {
>   int type;			/* EventTypeKeyboard */
>   unsigned int timeStamp;	/* time stamp */
>   int charCode;			/* character code in Mac Roman encoding */
>   int pressCode;		/* press code; any of EventKeyXXX */
>   int modifiers;		/* combination of xxxKeyBit */
>   int utf32Code;		/* UTF-32 unicode value */
>   int additionCharacterData;		/* Additional data about charcter for  
> platform specific tweak dispatching */
>   int windowIndex;		/* host window structure */
> } sqKeyboardEvent;



On May 15, 2007, at 12:09 PM, Bert Freudenberg wrote:

> On May 15, 2007, at 20:51 , Chris Petsos wrote:
>
>> We are trying to make Squeak work with Unicode...Yoshiki Ohshima has
>> been very helpful till now and his suggestion was to let all the data
>> that the platform (e.g. Windows, Unix etc...) is sending,  enter the
>> Squeak VM as is and deal with them there (in the image side) with
>> InputInterpreter classes.
>
> Yeah, I know, for some strange historical reason the Japanese folks  
> like this approach ;)
>
> I much prefer the very simple solution that John put into the Mac  
> VM - add a char32 field to each KeyStroke event containing the  
> unicode value. Nice and simple.
>
>> Another clue is that Squeak in Windows uses ANSI versions of Windows
>> functions which support only 8-bit characters
>
> That's highly irrelevant to the Unix VM. And for filenames we'd  
> most likely should use UTF-8 which is 8-bit and actually supported  
> by the Unix VM right now.
>
> - Bert -
>
>

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




More information about the Vm-dev mailing list