1 #include "qemu/osdep.h"
5 #include "standard-headers/linux/input.h"
7 #include "ui/input-keymap-atset1-to-qcode.c.inc"
8 #include "ui/input-keymap-linux-to-qcode.c.inc"
9 #include "ui/input-keymap-qcode-to-atset1.c.inc"
10 #include "ui/input-keymap-qcode-to-atset2.c.inc"
11 #include "ui/input-keymap-qcode-to-atset3.c.inc"
12 #include "ui/input-keymap-qcode-to-linux.c.inc"
13 #include "ui/input-keymap-qcode-to-qnum.c.inc"
14 #include "ui/input-keymap-qcode-to-sun.c.inc"
15 #include "ui/input-keymap-qnum-to-qcode.c.inc"
16 #include "ui/input-keymap-usb-to-qcode.c.inc"
17 #include "ui/input-keymap-win32-to-qcode.c.inc"
18 #include "ui/input-keymap-x11-to-qcode.c.inc"
19 #include "ui/input-keymap-xorgevdev-to-qcode.c.inc"
20 #include "ui/input-keymap-xorgkbd-to-qcode.c.inc"
21 #include "ui/input-keymap-xorgxquartz-to-qcode.c.inc"
22 #include "ui/input-keymap-xorgxwin-to-qcode.c.inc"
23 #include "ui/input-keymap-osx-to-qcode.c.inc"
25 int qemu_input_linux_to_qcode(unsigned int lnx
)
27 if (lnx
>= qemu_input_map_linux_to_qcode_len
) {
30 return qemu_input_map_linux_to_qcode
[lnx
];
33 int qemu_input_key_value_to_number(const KeyValue
*value
)
35 if (value
->type
== KEY_VALUE_KIND_QCODE
) {
36 if (value
->u
.qcode
.data
>= qemu_input_map_qcode_to_qnum_len
) {
39 return qemu_input_map_qcode_to_qnum
[value
->u
.qcode
.data
];
41 assert(value
->type
== KEY_VALUE_KIND_NUMBER
);
42 return value
->u
.number
.data
;
46 int qemu_input_key_number_to_qcode(unsigned int nr
)
48 if (nr
>= qemu_input_map_qnum_to_qcode_len
) {
51 return qemu_input_map_qnum_to_qcode
[nr
];
54 int qemu_input_key_value_to_qcode(const KeyValue
*value
)
56 if (value
->type
== KEY_VALUE_KIND_QCODE
) {
57 return value
->u
.qcode
.data
;
59 assert(value
->type
== KEY_VALUE_KIND_NUMBER
);
60 return qemu_input_key_number_to_qcode(value
->u
.number
.data
);
64 int qemu_input_key_value_to_scancode(const KeyValue
*value
, bool down
,
67 int keycode
= qemu_input_key_value_to_number(value
);
70 if (value
->type
== KEY_VALUE_KIND_QCODE
&&
71 value
->u
.qcode
.data
== Q_KEY_CODE_PAUSE
) {
73 int v
= down
? 0 : 0x80;
74 codes
[count
++] = 0xe1;
75 codes
[count
++] = 0x1d | v
;
76 codes
[count
++] = 0x45 | v
;
79 if (keycode
& SCANCODE_GREY
) {
80 codes
[count
++] = SCANCODE_EMUL0
;
81 keycode
&= ~SCANCODE_GREY
;
84 keycode
|= SCANCODE_UP
;
86 codes
[count
++] = keycode
;