Hi All,
I got pure Morphic MouseEvents forwarded just fine (thanks to your help on the bit-fiddling) and the translation is good enough to pop up a menu from the top menu bar. I had a screenshot, but it bounced the first iteration of this message, so you will have to take my word on that. (:
Next up is KeyboardEvents and at first glance it looks a bit daunting. Here is why.
This method in HandMorph invokes one of ~18 subclasses of KeyboardInputInterpreter
HandMorph>>generateKeyboardEvent: evtBuf .... type = #keystroke ifTrue: [keyValue := (self keyboardInterpreter nextCharFrom: Sensor firstEvt: evtBuf) asInteger] ...
That nextCharFrom: firstEvt: send is where it gets interesting as it is keyboard specific.
To see why, compare the implementation in
MacRomanInputInterpreter >>nextCharFrom: sensor firstEvt: evtBuf
| keyValue | keyValue := evtBuf third. ^ keyValue asCharacter macToSqueak.
to
UnicodeInputInterpreter>>nextCharFrom: sensor firstEvt: evtBuf "Compose Unicode character sequences" | peekEvent keyValue composed | "Only try this if the first event is composable and is a character event" ((Unicode isComposable: (keyValue := evtBuf sixth)) and:[evtBuf fourth = EventKeyChar]) ifTrue:[ "If we have a pending keyDown in the queue, skip that to get to the keystroke" peekEvent := sensor peekEvent. (peekEvent notNil and: [peekEvent fourth = EventKeyDown]) ifTrue: [ "skipEvent := "sensor nextEvent. peekEvent := sensor peekEvent]. "If we have another character event in the queue, compose it" (peekEvent notNil and: [peekEvent first = EventTypeKeyboard and:[peekEvent fourth = EventKeyChar]]) ifTrue:[ composed := Unicode compose: keyValue with: peekEvent sixth. composed ifNotNil:[ sensor nextEvent. ^composed]]]. "XXXX: Fixme. We should put the skipped event back if we haven't consumed it." ^keyValue asCharacter
So, assume I have to stuff some unknown character into a primitive event to feed to the simulator....I don't think "skooch and tack on" is going to work like it did for the mouseEvents.
I will be examining this more closely in a day or two as I have to focus on some work for a client, but wanted to get it out there for your thoughts on the matter in the meantime.
Thanks.
tty.
P.S. David, when you get time, Eliot mentioned getting with you so I could contribute my work. Let me know what I need to do at your convenience.