[Vm-dev] Handling function keys in unix

Bert Freudenberg bert at freudenbergs.de
Tue Nov 22 15:34:48 UTC 2011

On 22.11.2011, at 16:06, Igor Stasenko wrote:

> On 22 November 2011 15:51, Guillermo Polito <guillermopolito at gmail.com> wrote:
>> 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 :(.
> cannot help with it, i am complete newbie concerning unix/X11 keyboard handling.

ucs4 is UTF-32 (as google knows). It's plain unicode stored as an unsigned 32 bit value.

This is a character. So it is only meaningful in stroke events.

Function keys should only generate key down/up events, no strokes. And for encoding I suggest X11 codes (as defined in X11/keysymdef.h):

#define XK_F1			0xFFBE
#define XK_F2			0xFFBF
#define XK_F3			0xFFC0
#define XK_F4			0xFFC1
#define XK_F5			0xFFC2
#define XK_F6			0xFFC3
#define XK_F7			0xFFC4
#define XK_F8			0xFFC5
#define XK_F9			0xFFC6
#define XK_F10			0xFFC7
#define XK_F11			0xFFC8
#define XK_F12			0xFFC9

- Bert -

More information about the Vm-dev mailing list