@samitouri / QOSamiQemu / commits / 184c07600d

ui/input: Use Linux key codes for internal key events

Linux input key codes are a better internal representation than QKeyCode: - With Linux input key codes as the internal representation, keys previously lost solely because the middle layer between event sources and sinks used QKeyCode will be preserved, since Linux key codes cover all keys that those sources and sinks use. For example, KEY_KPJPCOMMA cannot be represented with QKeyCode, but it is widely supported by event sources and sinks since it is included in linux, atset1, atset2, usb, x11, osx, qnum (derived from atset1), xorgxquartz, and xorgevdev (derived from linux). - They make it possible to pass through Linux host key codes to Linux guests to preserve all key inputs. - They simplify consumers by avoiding QKeyCode aliases, namely asterisk/kp_multiply and sysrq/print. This matches the approach used by virtio and Xen. Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-ID: <20260520-input-v3-4-7c9e4c7abe34@rsg.ci.i.u-tokyo.ac.jp>

Akihiko Odaki committed May 20, 2026 at 15:47 UTC 184c07600d2c65204ffe7d98263e916e779c8aa8
16 files changed +151 -64
hw/arm/musicpal.c
+1 -1
@@ -1069,7 +1069,7 @@ static void musicpal_key_event(DeviceState *dev, QemuConsole *src,
1069 QemuInputEvent *evt)
1070 {
1071 musicpal_key_state *s = MUSICPAL_KEY(dev);
1072 - int qcode = evt->key.key;
1072 + int qcode = qemu_input_linux_to_qcode(evt->key.key);
1073 uint32_t event = 0;
1074 int i;
1075
hw/char/escc.c
+1 -1
@@ -800,7 +800,7 @@ static void sunkbd_handle_event(DeviceState *dev, QemuConsole *src,
800 int qcode, keycode;
801
802 assert(evt->type == INPUT_EVENT_KIND_KEY);
803 - qcode = evt->key.key;
803 + qcode = qemu_input_linux_to_qcode(evt->key.key);
804 trace_escc_sunkbd_event_in(qcode, QKeyCode_str(qcode),
805 evt->key.down);
806
hw/display/xenfb.c
+1 -1
@@ -203,7 +203,7 @@ static void xenfb_key_event(DeviceState *dev, QemuConsole *src,
203 QemuInputEvent *evt)
204 {
205 struct XenInput *xenfb = (struct XenInput *)dev;
206 - int qcode = evt->key.key;
206 + int qcode = qemu_input_linux_to_qcode(evt->key.key);
207 int lnx;
208
209 if (qcode < qemu_input_map_qcode_to_linux_len) {
hw/input/adb-kbd.c
+1 -1
@@ -311,7 +311,7 @@ static void adb_keyboard_event(DeviceState *dev, QemuConsole *src,
311 KBDState *s = (KBDState *)dev;
312 int qcode, keycode;
313
314 - qcode = evt->key.key;
314 + qcode = qemu_input_linux_to_qcode(evt->key.key);
315 if (qcode >= ARRAY_SIZE(qcode_to_adb_keycode)) {
316 return;
317 }
hw/input/hid.c
+2 -1
@@ -224,10 +224,11 @@ static void hid_keyboard_event(DeviceState *dev, QemuConsole *src,
224 QemuInputEvent *evt)
225 {
226 HIDState *hs = (HIDState *)dev;
227 + int qcode = qemu_input_linux_to_qcode(evt->key.key);
228 int scancodes[3], i, count;
229 int slot;
230
230 - count = qemu_input_qcode_to_scancode(evt->key.key, evt->key.down,
231 + count = qemu_input_qcode_to_scancode(qcode, evt->key.down,
232 scancodes);
233 if (hs->n + count > QUEUE_LENGTH) {
234 trace_hid_kbd_queue_full();
hw/input/ps2.c
+1 -1
@@ -324,7 +324,7 @@ static void ps2_keyboard_event(DeviceState *dev, QemuConsole *src,
324
325 qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER, NULL);
326 assert(evt->type == INPUT_EVENT_KIND_KEY);
327 - qcode = evt->key.key;
327 + qcode = qemu_input_linux_to_qcode(evt->key.key);
328
329 mod = ps2_modifier_bit(qcode);
330 trace_ps2_keyboard_event(s, qcode, evt->key.down, mod,
hw/input/stellaris_gamepad.c
+1 -1
@@ -19,7 +19,7 @@ static void stellaris_gamepad_event(DeviceState *dev, QemuConsole *src,
19 QemuInputEvent *evt)
20 {
21 StellarisGamepad *s = STELLARIS_GAMEPAD(dev);
22 - int qcode = evt->key.key;
22 + int qcode = qemu_input_linux_to_qcode(evt->key.key);
23 int i;
24
25 for (i = 0; i < s->num_buttons; i++) {
hw/input/virtio-input-hid.c
+1 -1
@@ -87,7 +87,7 @@ static void virtio_input_handle_event(DeviceState *dev, QemuConsole *src,
87
88 switch (evt->type) {
89 case INPUT_EVENT_KIND_KEY:
90 - qcode = evt->key.key;
90 + qcode = qemu_input_linux_to_qcode(evt->key.key);
91 if (qcode < qemu_input_map_qcode_to_linux_len &&
92 qemu_input_map_qcode_to_linux[qcode]) {
93 event.type = cpu_to_le16(EV_KEY);
hw/m68k/next-kbd.c
+1 -1
@@ -248,7 +248,7 @@ static void nextkbd_event(DeviceState *dev, QemuConsole *src,
248 NextKBDState *s = NEXTKBD(dev);
249 int qcode, keycode;
250
251 - qcode = evt->key.key;
251 + qcode = qemu_input_linux_to_qcode(evt->key.key);
252 if (qcode >= ARRAY_SIZE(qcode_to_nextkbd_keycode)) {
253 return;
254 }
include/ui/input.h
+48 -1
@@ -19,7 +19,7 @@ typedef struct QemuInputHandler QemuInputHandler;
19 typedef struct QemuInputHandlerState QemuInputHandlerState;
20
21 typedef struct QemuInputKeyEvent {
22 - QKeyCode key;
22 + unsigned int key;
23 bool down;
24 } QemuInputKeyEvent;
25
@@ -59,13 +59,18 @@ void qemu_input_event_sync(void);
59 void qemu_input_event_sync_impl(void);
60
61 void qemu_input_event_send_key(QemuConsole *src, KeyValue *key, bool down);
62 +void qemu_input_event_send_key_linux(QemuConsole *src, unsigned int lnx,
63 + bool down);
64 void qemu_input_event_send_key_number(QemuConsole *src, int num, bool down);
65 void qemu_input_event_send_key_qcode(QemuConsole *src, QKeyCode q, bool down);
66 void qemu_input_event_send_key_delay(uint32_t delay_ms);
67 int qemu_input_key_number_to_qcode(unsigned int nr);
68 +unsigned int qemu_input_key_number_to_linux(unsigned int nr);
69 int qemu_input_key_value_to_number(const KeyValue *value);
70 int qemu_input_key_value_to_qcode(const KeyValue *value);
71 +unsigned int qemu_input_key_value_to_linux(const KeyValue *value);
72 int qemu_input_qcode_to_scancode(QKeyCode qcode, bool down, int *codes);
73 +int qemu_input_linux_to_scancode(unsigned int lnx, bool down, int *codes);
74 int qemu_input_linux_to_qcode(unsigned int lnx);
75
76 void qemu_input_queue_btn(QemuConsole *src, InputButton btn, bool down);
@@ -107,52 +112,94 @@ void qemu_remove_mouse_mode_change_notifier(Notifier *notify);
112 extern const guint qemu_input_map_atset1_to_qcode_len;
113 extern const guint16 qemu_input_map_atset1_to_qcode[];
114
115 +extern const guint qemu_input_map_atset1_to_linux_len;
116 +extern const guint16 qemu_input_map_atset1_to_linux[];
117 +
118 extern const guint qemu_input_map_linux_to_qcode_len;
119 extern const guint16 qemu_input_map_linux_to_qcode[];
120
121 extern const guint qemu_input_map_qcode_to_atset1_len;
122 extern const guint16 qemu_input_map_qcode_to_atset1[];
123
124 +extern const guint qemu_input_map_linux_to_atset1_len;
125 +extern const guint16 qemu_input_map_linux_to_atset1[];
126 +
127 extern const guint qemu_input_map_qcode_to_atset2_len;
128 extern const guint16 qemu_input_map_qcode_to_atset2[];
129
130 +extern const guint qemu_input_map_linux_to_atset2_len;
131 +extern const guint16 qemu_input_map_linux_to_atset2[];
132 +
133 extern const guint qemu_input_map_qcode_to_atset3_len;
134 extern const guint16 qemu_input_map_qcode_to_atset3[];
135
136 +extern const guint qemu_input_map_linux_to_atset3_len;
137 +extern const guint16 qemu_input_map_linux_to_atset3[];
138 +
139 extern const guint qemu_input_map_qcode_to_linux_len;
140 extern const guint16 qemu_input_map_qcode_to_linux[];
141
142 extern const guint qemu_input_map_qcode_to_qnum_len;
143 extern const guint16 qemu_input_map_qcode_to_qnum[];
144
145 +extern const guint qemu_input_map_linux_to_qnum_len;
146 +extern const guint16 qemu_input_map_linux_to_qnum[];
147 +
148 extern const guint qemu_input_map_qcode_to_sun_len;
149 extern const guint16 qemu_input_map_qcode_to_sun[];
150
151 +extern const guint qemu_input_map_linux_to_sun_len;
152 +extern const guint16 qemu_input_map_linux_to_sun[];
153 +
154 extern const guint qemu_input_map_qnum_to_qcode_len;
155 extern const guint16 qemu_input_map_qnum_to_qcode[];
156
157 +extern const guint qemu_input_map_qnum_to_linux_len;
158 +extern const guint16 qemu_input_map_qnum_to_linux[];
159 +
160 extern const guint qemu_input_map_usb_to_qcode_len;
161 extern const guint16 qemu_input_map_usb_to_qcode[];
162
163 +extern const guint qemu_input_map_usb_to_linux_len;
164 +extern const guint16 qemu_input_map_usb_to_linux[];
165 +
166 extern const guint qemu_input_map_win32_to_qcode_len;
167 extern const guint16 qemu_input_map_win32_to_qcode[];
168
169 +extern const guint qemu_input_map_win32_to_linux_len;
170 +extern const guint16 qemu_input_map_win32_to_linux[];
171 +
172 extern const guint qemu_input_map_x11_to_qcode_len;
173 extern const guint16 qemu_input_map_x11_to_qcode[];
174
175 +extern const guint qemu_input_map_x11_to_linux_len;
176 +extern const guint16 qemu_input_map_x11_to_linux[];
177 +
178 extern const guint qemu_input_map_xorgevdev_to_qcode_len;
179 extern const guint16 qemu_input_map_xorgevdev_to_qcode[];
180
181 extern const guint qemu_input_map_xorgkbd_to_qcode_len;
182 extern const guint16 qemu_input_map_xorgkbd_to_qcode[];
183
184 +extern const guint qemu_input_map_xorgkbd_to_linux_len;
185 +extern const guint16 qemu_input_map_xorgkbd_to_linux[];
186 +
187 extern const guint qemu_input_map_xorgxquartz_to_qcode_len;
188 extern const guint16 qemu_input_map_xorgxquartz_to_qcode[];
189
190 +extern const guint qemu_input_map_xorgxquartz_to_linux_len;
191 +extern const guint16 qemu_input_map_xorgxquartz_to_linux[];
192 +
193 extern const guint qemu_input_map_xorgxwin_to_qcode_len;
194 extern const guint16 qemu_input_map_xorgxwin_to_qcode[];
195
196 +extern const guint qemu_input_map_xorgxwin_to_linux_len;
197 +extern const guint16 qemu_input_map_xorgxwin_to_linux[];
198 +
199 extern const guint qemu_input_map_osx_to_qcode_len;
200 extern const guint16 qemu_input_map_osx_to_qcode[];
201
202 +extern const guint qemu_input_map_osx_to_linux_len;
203 +extern const guint16 qemu_input_map_osx_to_linux[];
204 +
205 #endif /* INPUT_H */
replay/replay-input.c
+8 -3
@@ -24,7 +24,7 @@ void replay_save_input_event(QemuInputEvent *evt)
24 switch (evt->type) {
25 case INPUT_EVENT_KIND_KEY:
26 replay_put_dword(KEY_VALUE_KIND_QCODE);
27 - replay_put_dword(evt->key.key);
27 + replay_put_dword(qemu_input_linux_to_qcode(evt->key.key));
28 replay_put_byte(evt->key.down);
29 break;
30 case INPUT_EVENT_KIND_BTN:
@@ -55,20 +55,25 @@ void replay_save_input_event(QemuInputEvent *evt)
55 QemuInputEvent *replay_read_input_event(void)
56 {
57 QemuInputEvent *evt = g_new(QemuInputEvent, 1);
58 + int qcode;
59
60 evt->type = replay_get_dword();
61 switch (evt->type) {
62 case INPUT_EVENT_KIND_KEY:
63 switch (replay_get_dword()) {
64 case KEY_VALUE_KIND_NUMBER:
64 - evt->key.key = qemu_input_key_number_to_qcode(replay_get_qword());
65 + qcode = qemu_input_key_number_to_qcode(replay_get_qword());
66 evt->key.down = replay_get_byte();
67 break;
68 case KEY_VALUE_KIND_QCODE:
68 - evt->key.key = (QKeyCode)replay_get_dword();
69 + qcode = (QKeyCode)replay_get_dword();
70 evt->key.down = replay_get_byte();
71 break;
72 + default:
73 + g_assert_not_reached();
74 }
75 + evt->key.key = qcode < qemu_input_map_qcode_to_linux_len ?
76 + qemu_input_map_qcode_to_linux[qcode] : 0;
77 break;
78 case INPUT_EVENT_KIND_BTN:
79 evt->btn.button = (InputButton)replay_get_dword();
tools/qemu-vnc/input.c
+10 -3
@@ -82,11 +82,18 @@ void qemu_input_event_send_key_delay(uint32_t delay_ms)
82 }
83
84 void qemu_input_event_send_key_qcode(QemuConsole *src, QKeyCode q, bool down)
85 +{
86 + unsigned int lnx = qemu_input_map_qcode_to_linux[q];
87 + qemu_input_event_send_key_linux(src, lnx, down);
88 +}
89 +
90 +void qemu_input_event_send_key_linux(QemuConsole *src, unsigned int lnx,
91 + bool down)
92 {
93 QemuDBusDisplay1Keyboard *kbd;
94 guint qnum;
95
89 - trace_qemu_vnc_key_event(q, down);
96 + trace_qemu_vnc_key_event(lnx, down);
97
98 if (!src) {
99 return;
@@ -96,10 +103,10 @@ void qemu_input_event_send_key_qcode(QemuConsole *src, QKeyCode q, bool down)
103 return;
104 }
105
99 - if (q >= qemu_input_map_qcode_to_qnum_len) {
106 + if (lnx >= qemu_input_map_linux_to_qnum_len) {
107 return;
108 }
102 - qnum = qemu_input_map_qcode_to_qnum[q];
109 + qnum = qemu_input_map_linux_to_qnum[lnx];
110
111 if (down) {
112 qemu_dbus_display1_keyboard_call_press(
tools/qemu-vnc/trace-events
+1 -1
@@ -12,7 +12,7 @@ qemu_vnc_cursor_define(int width, int height, int hot_x, int hot_y) "w=%d h=%d h
12 qemu_vnc_input_abs(uint32_t x, uint32_t y) "x=%u y=%u"
13 qemu_vnc_input_btn(int button, bool press) "button=%d press=%d"
14 qemu_vnc_input_rel(int dx, int dy) "dx=%d dy=%d"
15 -qemu_vnc_key_event(int qcode, bool down) "qcode=%d down=%d"
15 +qemu_vnc_key_event(unsigned int lnx, bool down) "lnx=%u down=%d"
16 qemu_vnc_owner_appeared(const char *name) "peer=%s"
17 qemu_vnc_owner_vanished(const char *name) "peer=%s"
18 qemu_vnc_scanout(uint32_t width, uint32_t height, uint32_t stride, uint32_t format) "w=%u h=%u stride=%u fmt=0x%x"
ui/input-keymap.c
+45 -11
@@ -5,22 +5,36 @@
5 #include "standard-headers/linux/input.h"
6
7 #include "ui/input-keymap-atset1-to-qcode.c.inc"
8 +#include "ui/input-keymap-atset1-to-linux.c.inc"
9 #include "ui/input-keymap-linux-to-qcode.c.inc"
10 #include "ui/input-keymap-qcode-to-atset1.c.inc"
11 +#include "ui/input-keymap-linux-to-atset1.c.inc"
12 #include "ui/input-keymap-qcode-to-atset2.c.inc"
13 +#include "ui/input-keymap-linux-to-atset2.c.inc"
14 #include "ui/input-keymap-qcode-to-atset3.c.inc"
15 +#include "ui/input-keymap-linux-to-atset3.c.inc"
16 #include "ui/input-keymap-qcode-to-linux.c.inc"
17 #include "ui/input-keymap-qcode-to-qnum.c.inc"
18 +#include "ui/input-keymap-linux-to-qnum.c.inc"
19 #include "ui/input-keymap-qcode-to-sun.c.inc"
20 +#include "ui/input-keymap-linux-to-sun.c.inc"
21 #include "ui/input-keymap-qnum-to-qcode.c.inc"
22 +#include "ui/input-keymap-qnum-to-linux.c.inc"
23 #include "ui/input-keymap-usb-to-qcode.c.inc"
24 +#include "ui/input-keymap-usb-to-linux.c.inc"
25 #include "ui/input-keymap-win32-to-qcode.c.inc"
26 +#include "ui/input-keymap-win32-to-linux.c.inc"
27 #include "ui/input-keymap-x11-to-qcode.c.inc"
28 +#include "ui/input-keymap-x11-to-linux.c.inc"
29 #include "ui/input-keymap-xorgevdev-to-qcode.c.inc"
30 #include "ui/input-keymap-xorgkbd-to-qcode.c.inc"
31 +#include "ui/input-keymap-xorgkbd-to-linux.c.inc"
32 #include "ui/input-keymap-xorgxquartz-to-qcode.c.inc"
33 +#include "ui/input-keymap-xorgxquartz-to-linux.c.inc"
34 #include "ui/input-keymap-xorgxwin-to-qcode.c.inc"
35 +#include "ui/input-keymap-xorgxwin-to-linux.c.inc"
36 #include "ui/input-keymap-osx-to-qcode.c.inc"
37 +#include "ui/input-keymap-osx-to-linux.c.inc"
38
39 int qemu_input_linux_to_qcode(unsigned int lnx)
40 {
@@ -45,29 +59,49 @@ int qemu_input_key_value_to_number(const KeyValue *value)
59
60 int qemu_input_key_number_to_qcode(unsigned int nr)
61 {
48 - if (nr >= qemu_input_map_qnum_to_qcode_len) {
49 - return 0;
62 + return qemu_input_linux_to_qcode(qemu_input_key_number_to_linux(nr));
63 +}
64 +
65 +unsigned int qemu_input_key_number_to_linux(unsigned int nr)
66 +{
67 + if (nr >= qemu_input_map_qnum_to_linux_len) {
68 + return KEY_RESERVED;
69 }
51 - return qemu_input_map_qnum_to_qcode[nr];
70 + return qemu_input_map_qnum_to_linux[nr];
71 }
72
73 int qemu_input_key_value_to_qcode(const KeyValue *value)
74 {
56 - if (value->type == KEY_VALUE_KIND_QCODE) {
57 - return value->u.qcode.data;
58 - } else {
59 - assert(value->type == KEY_VALUE_KIND_NUMBER);
60 - return qemu_input_key_number_to_qcode(value->u.number.data);
75 + return qemu_input_linux_to_qcode(qemu_input_key_value_to_linux(value));
76 +}
77 +
78 +unsigned int qemu_input_key_value_to_linux(const KeyValue *value)
79 +{
80 + switch (value->type) {
81 + case KEY_VALUE_KIND_NUMBER:
82 + return qemu_input_key_number_to_linux(value->u.number.data);
83 +
84 + case KEY_VALUE_KIND_QCODE:
85 + return qemu_input_map_qcode_to_linux[value->u.qcode.data];
86 +
87 + default:
88 + g_assert_not_reached();
89 }
90 }
91
92 int qemu_input_qcode_to_scancode(QKeyCode qcode, bool down, int *codes)
93 {
66 - int keycode = qcode < qemu_input_map_qcode_to_qnum_len ?
67 - qemu_input_map_qcode_to_qnum[qcode] : 0;
94 + return qemu_input_linux_to_scancode(qemu_input_map_qcode_to_linux[qcode],
95 + down, codes);
96 +}
97 +
98 +int qemu_input_linux_to_scancode(unsigned int lnx, bool down, int *codes)
99 +{
100 + int keycode = lnx < qemu_input_map_linux_to_qnum_len ?
101 + qemu_input_map_linux_to_qnum[lnx] : 0;
102 int count = 0;
103
70 - if (qcode == Q_KEY_CODE_PAUSE) {
104 + if (lnx == KEY_PAUSE) {
105 /* specific case */
106 int v = down ? 0 : 0x80;
107 codes[count++] = 0xe1;
ui/input.c
+15 -36
@@ -165,25 +165,10 @@ void qmp_input_send_event(const char *device,
165 evt.type = qapi->type;
166
167 switch (qapi->type) {
168 - case INPUT_EVENT_KIND_KEY: {
169 - KeyValue *key = qapi->u.key.data->key;
170 - QKeyCode code;
171 -
172 - switch (key->type) {
173 - case KEY_VALUE_KIND_NUMBER:
174 - code = qemu_input_key_number_to_qcode(key->u.number.data);
175 - break;
176 - case KEY_VALUE_KIND_QCODE:
177 - code = key->u.qcode.data;
178 - break;
179 - default:
180 - g_assert_not_reached();
181 - }
182 -
183 - evt.key.key = code;
168 + case INPUT_EVENT_KIND_KEY:
169 + evt.key.key = qemu_input_key_value_to_linux(qapi->u.key.data->key);
170 evt.key.down = qapi->u.key.data->down;
171 break;
186 - }
172
173 case INPUT_EVENT_KIND_BTN:
174 evt.btn = *qapi->u.btn.data;
@@ -226,7 +211,7 @@ static void qemu_input_event_trace(QemuConsole *src, QemuInputEvent *evt)
211 switch (evt->type) {
212 case INPUT_EVENT_KIND_KEY:
213 key = &evt->key;
229 - name = QKeyCode_str(key->key);
214 + name = QKeyCode_str(qemu_input_linux_to_qcode(key->key));
215 trace_input_event_key_qcode(idx, name, key->down);
216 break;
217 case INPUT_EVENT_KIND_BTN:
@@ -343,19 +328,6 @@ void qemu_input_event_send_impl(QemuConsole *src, QemuInputEvent *evt)
328
329 void qemu_input_event_send(QemuConsole *src, QemuInputEvent *evt)
330 {
346 - /*
347 - * 'sysrq' was mistakenly added to hack around the fact that
348 - * the ps2 driver was not generating correct scancodes sequences
349 - * when 'alt+print' was pressed. This flaw is now fixed and the
350 - * 'sysrq' key serves no further purpose. We normalize it to
351 - * 'print', so that downstream receivers of the event don't
352 - * need to deal with this mistake
353 - */
354 - if (evt->type == INPUT_EVENT_KIND_KEY &&
355 - evt->key.key == Q_KEY_CODE_SYSRQ) {
356 - evt->key.key = Q_KEY_CODE_PRINT;
357 - }
358 -
331 if (!runstate_is_running() && !runstate_check(RUN_STATE_SUSPENDED)) {
332 return;
333 }
@@ -390,17 +362,24 @@ void qemu_input_event_sync(void)
362 }
363
364 void qemu_input_event_send_key(QemuConsole *src, KeyValue *key, bool down)
365 +{
366 + unsigned int lnx = qemu_input_key_value_to_linux(key);
367 +
368 + g_free(key);
369 + qemu_input_event_send_key_linux(src, lnx, down);
370 +}
371 +
372 +void qemu_input_event_send_key_linux(QemuConsole *src, unsigned int lnx,
373 + bool down)
374 {
375 QemuInputEvent evt = {
376 .type = INPUT_EVENT_KIND_KEY,
377 .key = {
397 - .key = qemu_input_key_value_to_qcode(key),
378 + .key = lnx,
379 .down = down,
380 },
381 };
382
402 - g_free(key);
403 -
383 if (QTAILQ_EMPTY(&kbd_queue)) {
384 qemu_input_event_send(src, &evt);
385 qemu_input_event_sync();
@@ -412,8 +391,8 @@ void qemu_input_event_send_key(QemuConsole *src, KeyValue *key, bool down)
391
392 void qemu_input_event_send_key_number(QemuConsole *src, int num, bool down)
393 {
415 - QKeyCode code = qemu_input_key_number_to_qcode(num);
416 - qemu_input_event_send_key_qcode(src, code, down);
394 + unsigned int lnx = qemu_input_key_number_to_linux(num);
395 + qemu_input_event_send_key_linux(src, lnx, down);
396 }
397
398 void qemu_input_event_send_key_qcode(QemuConsole *src, QKeyCode q, bool down)
ui/meson.build
+14
@@ -1,21 +1,35 @@
1 keymaps = [
2 ['atset1', 'qcode'],
3 + ['atset1', 'linux'],
4 ['linux', 'qcode'],
5 ['qcode', 'atset1'],
6 + ['linux', 'atset1'],
7 ['qcode', 'atset2'],
8 + ['linux', 'atset2'],
9 ['qcode', 'atset3'],
10 + ['linux', 'atset3'],
11 ['qcode', 'linux'],
12 ['qcode', 'qnum'],
13 + ['linux', 'qnum'],
14 ['qcode', 'sun'],
15 + ['linux', 'sun'],
16 ['qnum', 'qcode'],
17 + ['qnum', 'linux'],
18 ['usb', 'qcode'],
19 + ['usb', 'linux'],
20 ['win32', 'qcode'],
21 + ['win32', 'linux'],
22 ['x11', 'qcode'],
23 + ['x11', 'linux'],
24 ['xorgevdev', 'qcode'],
25 ['xorgkbd', 'qcode'],
26 + ['xorgkbd', 'linux'],
27 ['xorgxquartz', 'qcode'],
28 + ['xorgxquartz', 'linux'],
29 ['xorgxwin', 'qcode'],
30 + ['xorgxwin', 'linux'],
31 ['osx', 'qcode'],
32 + ['osx', 'linux'],
33 ]
34
35 if have_system or xkbcommon.found()