[Vm-dev] Handling function keys in unix
Guillermo Polito
guillermopolito at gmail.com
Tue Nov 22 14:51:47 UTC 2011
So far, what I've learnt/found :).
1) I assume my build is using X11-display, since my keyboard events are
generated there :P.
2) The X11 keyboard events are adapted to sq events in sqUnixX11.c >>
x2sqKeyPlain
3) This build uses XLookupString, which brings char codes in Latin 1
instead of UTF-8. But X11 seems to support UTF-8 :/.
4) When pressing a function key, XLookupString does not fill the buffer
with chars... and the KeySym is not handled. I added a line like
case XK_F1: return 50;
and
Character class>>F1
^ self value: 50
to test, and It works :). But I'm not sure which code is better to be
returned yet :P.
5) My image now handles the F1, but only the keyDown and keyUp, since in
sqUnixX11.c >> handleEvent I have something like:
if (ucs4) /* only generate a key char event if there's a code. */
recordKeyboardEvent(keyCode, EventKeyChar, modifierState, ucs4);
6) I tried commenting the if, but that generates some garbage in my image
when pressing Alt, Shift, Control...
So, some questions I have at this point:
- Which are the restrictions on the codes returned on translateCode (point
4) ? Are they ascii characters? In the image I see the value is the
keychar + the modifiers encoded
- Based on the prior question, Which codes should be assigned to function
keys?
- I don't fully understand yet what a ucs4 code is, but the keysyms are
translated to them in sqUnixX11.c >> xkeysym2ucs4 which looks pretty
magical :). Does someone know how this works? The comments are not really
helpful :(.
Thanks!
Guille, vming :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20111122/badb8f26/attachment.htm
More information about the Vm-dev
mailing list