qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Definition of the UI layer's "key number" ?


From: Gerd Hoffmann
Subject: Re: [Qemu-devel] Definition of the UI layer's "key number" ?
Date: Mon, 09 Feb 2015 09:27:05 +0100

On Do, 2015-02-05 at 17:36 +0000, Peter Maydell wrote:
> Hi; I'm trying to find out what the UI layer's definition of
> a "key number" is (ie what qemu_input_event_send_key_number()'s
> "num" parameter is). We don't seem to document this anywhere,
> which makes writing UI frontends tricky...

Well, we have two ways to represent a key code in qemu, unfortunately in
the QMP api (see KeyValue in qapi-schema.json).

One is QKeyCode (defined in qapi-schema.json too), the other "key
number" is the key coding used pretty much everywhere in qemu before the
input layer rewrite (the new code in ui/input*.c) got merged.  It is
based on ps/2 keycodes.

For new code I strongly suggest to simply ignore the old "key number"
coding and use QKeyCodes exclusively, it allows you to have nicely
readable mappings like the one in ui/sdl2-keymap.h.  Then use
qemu_input_event_send_key_qcode() to feed the guest with the keyboard
input.

ui/input-keymap.c has a table to map QKeyCodes to "key numbers" and
helper functions to translate codes both ways.

cheers,
  Gerd





reply via email to

[Prev in Thread] Current Thread [Next in Thread]