[Vm-dev] Simulated mousEvents are now pure morphic...your thoughts on tackling keyboard events requested

Bert Freudenberg bert at freudenbergs.de
Fri Feb 14 10:33:45 UTC 2014


On 14.02.2014, at 00:34, gettimothy <gettimothy at zoho.com> wrote:

> 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.

Nice! :)

> Next up is KeyboardEvents and at first glance it looks a bit daunting.

Key stroke events are pretty simple: you just put the ASCII code into one field and the Unicode into another. This is the same on pretty much any platform now.

But for full emulation you also need to emulate key down and key up events. Those are platform-specific, each has their own raw key codes. Unfortunately we never took the time to make all platforms present key codes uniformly. (We could still do it: up/down events are almost completely unused, partly because of this problem).

If you want to emulate up/down events, I think your best bet will be to emulate a Windows VM. Because on Windows, the keycodes are based on ASCII - the 'a' key has key code 65. This must be independent on whether shift is pressed or not, because it refers to the physical key. If you wanted to emulate Mac you'ld have to generate Mac key codes (A=0, S=1, D=2, F=3, etc). Unix/X11 might be easier too, I think it uses X11 keysyms, but IIRC the Unix VM does give different key codes for a and shift-a, which is wrong.

- Bert -

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4142 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20140214/2e6e0363/smime.bin


More information about the Vm-dev mailing list