[Vm-dev] Handling function keys in unix

Guillermo Polito guillermopolito at gmail.com
Tue Nov 22 18:11:43 UTC 2011

On Tue, Nov 22, 2011 at 12:06 PM, Igor Stasenko <siguctua at gmail.com> wrote:

> because these keys are not producing "characters", but they are kind
> of "meta" keys which could modify the input.
> as far as i understood, this line of code tells that it generates the
> "KeyChar" event only if there's a character key pressed.
> for other keys, like arrows, home/pgUp/pgDn etc you have key codes,
> but not char codes, because there is no direct mapping between them
> and any ascii/unicode character.

> imagine that all keys on your keyboard having a number. Esc -  1 , F1 - 2
> , etc.
> So, these numbers are key codes. Now some keys can be directly
> translated to characters when pressed (depending on keyboard
> layout/language settings), but some of them not, and has only the key
> code.

Hmm, but in my image, if I press the left arrow, I get a KeyPress :P.  So
it's cheating! haha.

More, on, look at this for example:

  case XK_Left:    return 28;
    case XK_Up:        return 30;
    case XK_Right:    return 29;
    case XK_Down:    return 31;
    case XK_Insert:    return  5;
    case XK_Prior:    return 11;    /* page up */
    case XK_Next:    return 12;    /* page down */
    case XK_Home:    return  1;
    case XK_End:    return  4;

    case XK_KP_Left:    return 28;
    case XK_KP_Up:    return 30;
    case XK_KP_Right:    return 29;
    case XK_KP_Down:    return 31;
    case XK_KP_Insert:    return  5;
    case XK_KP_Prior:    return 11;    /* page up */
    case XK_KP_Next:    return 12;    /* page down */
    case XK_KP_Home:    return  1;
    case XK_KP_End:    return  4;

All those keys are treated as characters since their value is < 128 :S

What I'm wondering now is:  Should keybindings/shortcuts/"whatever name you
want for them" be activated on keypress, keydown or keyup?

I'll have a look at eclipse source code xD.

Thank you very much :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20111122/a029d13c/attachment.htm

More information about the Vm-dev mailing list