* [Qemu-devel] [PATCH 1/3] input: add qemu_input_key_number_to_qcode @ 2014-05-21 12:00 Gerd Hoffmann 2014-05-21 12:00 ` [Qemu-devel] [PATCH 2/3] input: add name to input_event_key_number Gerd Hoffmann 2014-05-21 12:00 ` [Qemu-devel] [PATCH 3/3] input: keymap: add meta keys Gerd Hoffmann 0 siblings, 2 replies; 3+ messages in thread From: Gerd Hoffmann @ 2014-05-21 12:00 UTC (permalink / raw) To: qemu-devel; +Cc: Gerd Hoffmann, Anthony Liguori Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> --- include/ui/input.h | 1 + ui/input-keymap.c | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/include/ui/input.h b/include/ui/input.h index 3d3d487..d84ed8b 100644 --- a/include/ui/input.h +++ b/include/ui/input.h @@ -36,6 +36,7 @@ InputEvent *qemu_input_event_new_key(KeyValue *key, bool down); void qemu_input_event_send_key(QemuConsole *src, KeyValue *key, bool down); void qemu_input_event_send_key_number(QemuConsole *src, int num, bool down); void qemu_input_event_send_key_qcode(QemuConsole *src, QKeyCode q, bool down); +int qemu_input_key_number_to_qcode(uint8_t nr); int qemu_input_key_value_to_number(const KeyValue *value); int qemu_input_key_value_to_qcode(const KeyValue *value); int qemu_input_key_value_to_scancode(const KeyValue *value, bool down, diff --git a/ui/input-keymap.c b/ui/input-keymap.c index 6da4495..4c4f0d0 100644 --- a/ui/input-keymap.c +++ b/ui/input-keymap.c @@ -129,7 +129,7 @@ static const int qcode_to_number[] = { [Q_KEY_CODE_MAX] = 0, }; -static int number_to_qcode[0xff]; +static int number_to_qcode[0x100]; int qemu_input_key_value_to_number(const KeyValue *value) { @@ -141,7 +141,7 @@ int qemu_input_key_value_to_number(const KeyValue *value) } } -int qemu_input_key_value_to_qcode(const KeyValue *value) +int qemu_input_key_number_to_qcode(uint8_t nr) { static int first = true; @@ -155,11 +155,16 @@ int qemu_input_key_value_to_qcode(const KeyValue *value) } } + return number_to_qcode[nr]; +} + +int qemu_input_key_value_to_qcode(const KeyValue *value) +{ if (value->kind == KEY_VALUE_KIND_QCODE) { return value->qcode; } else { assert(value->kind == KEY_VALUE_KIND_NUMBER); - return number_to_qcode[value->number]; + return qemu_input_key_number_to_qcode(value->number); } } -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* [Qemu-devel] [PATCH 2/3] input: add name to input_event_key_number 2014-05-21 12:00 [Qemu-devel] [PATCH 1/3] input: add qemu_input_key_number_to_qcode Gerd Hoffmann @ 2014-05-21 12:00 ` Gerd Hoffmann 2014-05-21 12:00 ` [Qemu-devel] [PATCH 3/3] input: keymap: add meta keys Gerd Hoffmann 1 sibling, 0 replies; 3+ messages in thread From: Gerd Hoffmann @ 2014-05-21 12:00 UTC (permalink / raw) To: qemu-devel; +Cc: Gerd Hoffmann, Anthony Liguori Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> --- trace-events | 2 +- ui/input.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/trace-events b/trace-events index b6d289d..0870204 100644 --- a/trace-events +++ b/trace-events @@ -1050,7 +1050,7 @@ gd_update(int x, int y, int w, int h) "x=%d, y=%d, w=%d, h=%d" gd_key_event(int gdk_keycode, int qemu_keycode, const char *action) "translated GDK keycode %d to QEMU keycode %d (%s)" # ui/input.c -input_event_key_number(int conidx, int number, bool down) "con %d, key number 0x%x, down %d" +input_event_key_number(int conidx, int number, const char *qcode, bool down) "con %d, key number 0x%x [%s], down %d" input_event_key_qcode(int conidx, const char *qcode, bool down) "con %d, key qcode %s, down %d" input_event_btn(int conidx, const char *btn, bool down) "con %d, button %s, down %d" input_event_rel(int conidx, const char *axis, int value) "con %d, axis %s, value %d" diff --git a/ui/input.c b/ui/input.c index fc91fba..9d63035 100644 --- a/ui/input.c +++ b/ui/input.c @@ -94,7 +94,7 @@ static void qemu_input_transform_abs_rotate(InputEvent *evt) static void qemu_input_event_trace(QemuConsole *src, InputEvent *evt) { const char *name; - int idx = -1; + int qcode, idx = -1; if (src) { idx = qemu_console_get_index(src); @@ -103,8 +103,10 @@ static void qemu_input_event_trace(QemuConsole *src, InputEvent *evt) case INPUT_EVENT_KIND_KEY: switch (evt->key->key->kind) { case KEY_VALUE_KIND_NUMBER: + qcode = qemu_input_key_number_to_qcode(evt->key->key->number); + name = QKeyCode_lookup[qcode]; trace_input_event_key_number(idx, evt->key->key->number, - evt->key->down); + name, evt->key->down); break; case KEY_VALUE_KIND_QCODE: name = QKeyCode_lookup[evt->key->key->qcode]; -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* [Qemu-devel] [PATCH 3/3] input: keymap: add meta keys 2014-05-21 12:00 [Qemu-devel] [PATCH 1/3] input: add qemu_input_key_number_to_qcode Gerd Hoffmann 2014-05-21 12:00 ` [Qemu-devel] [PATCH 2/3] input: add name to input_event_key_number Gerd Hoffmann @ 2014-05-21 12:00 ` Gerd Hoffmann 1 sibling, 0 replies; 3+ messages in thread From: Gerd Hoffmann @ 2014-05-21 12:00 UTC (permalink / raw) To: qemu-devel; +Cc: Gerd Hoffmann, Anthony Liguori Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> --- ui/input-keymap.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ui/input-keymap.c b/ui/input-keymap.c index 4c4f0d0..5d29935 100644 --- a/ui/input-keymap.c +++ b/ui/input-keymap.c @@ -13,6 +13,8 @@ static const int qcode_to_number[] = { [Q_KEY_CODE_CTRL] = 0x1d, [Q_KEY_CODE_CTRL_R] = 0x9d, + [Q_KEY_CODE_META_L] = 0xdb, + [Q_KEY_CODE_META_R] = 0xdc, [Q_KEY_CODE_MENU] = 0xdd, [Q_KEY_CODE_ESC] = 0x01, -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-05-21 12:49 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-05-21 12:00 [Qemu-devel] [PATCH 1/3] input: add qemu_input_key_number_to_qcode Gerd Hoffmann 2014-05-21 12:00 ` [Qemu-devel] [PATCH 2/3] input: add name to input_event_key_number Gerd Hoffmann 2014-05-21 12:00 ` [Qemu-devel] [PATCH 3/3] input: keymap: add meta keys Gerd Hoffmann
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).