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
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;
-- ======================================================================== === John M. McIntosh johnmci@smalltalkconsulting.com 1-800-477-2659 Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com ======================================================================== ===