root / keymaps.h @ c05c7a73
History | View | Annotate | Download (2.4 kB)
1 | 5f5aed22 | aliguori | /*
|
---|---|---|---|
2 | 5f5aed22 | aliguori | * QEMU keysym to keycode conversion using rdesktop keymaps
|
3 | 5f5aed22 | aliguori | *
|
4 | 5f5aed22 | aliguori | * Copyright (c) 2004 Johannes Schindelin
|
5 | 5f5aed22 | aliguori | *
|
6 | 5f5aed22 | aliguori | * Permission is hereby granted, free of charge, to any person obtaining a copy
|
7 | 5f5aed22 | aliguori | * of this software and associated documentation files (the "Software"), to deal
|
8 | 5f5aed22 | aliguori | * in the Software without restriction, including without limitation the rights
|
9 | 5f5aed22 | aliguori | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10 | 5f5aed22 | aliguori | * copies of the Software, and to permit persons to whom the Software is
|
11 | 5f5aed22 | aliguori | * furnished to do so, subject to the following conditions:
|
12 | 5f5aed22 | aliguori | *
|
13 | 5f5aed22 | aliguori | * The above copyright notice and this permission notice shall be included in
|
14 | 5f5aed22 | aliguori | * all copies or substantial portions of the Software.
|
15 | 5f5aed22 | aliguori | *
|
16 | 5f5aed22 | aliguori | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17 | 5f5aed22 | aliguori | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18 | 5f5aed22 | aliguori | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
19 | 5f5aed22 | aliguori | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20 | 5f5aed22 | aliguori | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21 | 5f5aed22 | aliguori | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22 | 5f5aed22 | aliguori | * THE SOFTWARE.
|
23 | 5f5aed22 | aliguori | */
|
24 | 5f5aed22 | aliguori | |
25 | 5f5aed22 | aliguori | #ifndef __QEMU_KEYMAPS_H__
|
26 | 5f5aed22 | aliguori | #define __QEMU_KEYMAPS_H__
|
27 | 5f5aed22 | aliguori | |
28 | 5f5aed22 | aliguori | #include "qemu-common.h" |
29 | 5f5aed22 | aliguori | |
30 | 5f5aed22 | aliguori | typedef struct { |
31 | 5f5aed22 | aliguori | const char* name; |
32 | 5f5aed22 | aliguori | int keysym;
|
33 | c227f099 | Anthony Liguori | } name2keysym_t; |
34 | 5f5aed22 | aliguori | |
35 | 5f5aed22 | aliguori | struct key_range {
|
36 | 5f5aed22 | aliguori | int start;
|
37 | 5f5aed22 | aliguori | int end;
|
38 | 5f5aed22 | aliguori | struct key_range *next;
|
39 | 5f5aed22 | aliguori | }; |
40 | 5f5aed22 | aliguori | |
41 | 5f5aed22 | aliguori | #define MAX_NORMAL_KEYCODE 512 |
42 | 5f5aed22 | aliguori | #define MAX_EXTRA_COUNT 256 |
43 | 5f5aed22 | aliguori | typedef struct { |
44 | 5f5aed22 | aliguori | uint16_t keysym2keycode[MAX_NORMAL_KEYCODE]; |
45 | 5f5aed22 | aliguori | struct {
|
46 | 5f5aed22 | aliguori | int keysym;
|
47 | 5f5aed22 | aliguori | uint16_t keycode; |
48 | 5f5aed22 | aliguori | } keysym2keycode_extra[MAX_EXTRA_COUNT]; |
49 | 5f5aed22 | aliguori | int extra_count;
|
50 | 5f5aed22 | aliguori | struct key_range *keypad_range;
|
51 | 5f5aed22 | aliguori | struct key_range *numlock_range;
|
52 | c227f099 | Anthony Liguori | } kbd_layout_t; |
53 | 5f5aed22 | aliguori | |
54 | 44bb61c8 | Samuel Thibault | /* scancode without modifiers */
|
55 | 44bb61c8 | Samuel Thibault | #define SCANCODE_KEYMASK 0xff |
56 | 44bb61c8 | Samuel Thibault | /* scancode without grey or up bit */
|
57 | 44bb61c8 | Samuel Thibault | #define SCANCODE_KEYCODEMASK 0x7f |
58 | 44bb61c8 | Samuel Thibault | |
59 | 44bb61c8 | Samuel Thibault | /* "grey" keys will usually need a 0xe0 prefix */
|
60 | 44bb61c8 | Samuel Thibault | #define SCANCODE_GREY 0x80 |
61 | 44bb61c8 | Samuel Thibault | #define SCANCODE_EMUL0 0xE0 |
62 | 44bb61c8 | Samuel Thibault | /* "up" flag */
|
63 | 44bb61c8 | Samuel Thibault | #define SCANCODE_UP 0x80 |
64 | 44bb61c8 | Samuel Thibault | |
65 | 44bb61c8 | Samuel Thibault | /* Additional modifiers to use if not catched another way. */
|
66 | 44bb61c8 | Samuel Thibault | #define SCANCODE_SHIFT 0x100 |
67 | 44bb61c8 | Samuel Thibault | #define SCANCODE_CTRL 0x200 |
68 | 44bb61c8 | Samuel Thibault | #define SCANCODE_ALT 0x400 |
69 | 44bb61c8 | Samuel Thibault | #define SCANCODE_ALTGR 0x800 |
70 | 44bb61c8 | Samuel Thibault | |
71 | 5f5aed22 | aliguori | |
72 | c227f099 | Anthony Liguori | void *init_keyboard_layout(const name2keysym_t *table, const char *language); |
73 | 5f5aed22 | aliguori | int keysym2scancode(void *kbd_layout, int keysym); |
74 | 5f5aed22 | aliguori | int keycode_is_keypad(void *kbd_layout, int keycode); |
75 | 5f5aed22 | aliguori | int keysym_is_numlock(void *kbd_layout, int keysym); |
76 | 5f5aed22 | aliguori | |
77 | 5f5aed22 | aliguori | #endif /* __QEMU_KEYMAPS_H__ */ |