revert between 56095 -> 55830 in arch
[AROS.git] / arch / all-hosted / hidd / sdl / keymap.c
blob64e6a302f1d560c6ec3aa2a08e639fee2041ea5c
1 /*
2 * sdl.hidd - SDL graphics/sound/keyboard for AROS hosted
3 * Copyright (c) 2007 Robert Norris. All rights reserved.
4 * Copyright (c) 2010 The AROS Development Team. All rights reserved.
6 * This program is free software; you can redistribute it and/or modify it
7 * under the same terms as AROS itself.
8 */
10 #include <exec/types.h>
12 #include <devices/rawkeycodes.h>
14 #ifdef __THROW
15 #undef __THROW
16 #endif
17 #ifdef __CONCAT
18 #undef __CONCAT
19 #endif
21 #include "sdl_intern.h"
23 #define DEBUG 0
24 #include <aros/debug.h>
26 struct keymap {
27 SDLKey sdl;
28 UBYTE aros;
31 /* the SDLK_* names are taken from SDL/SDL_keysym.h. I've only included the
32 * ones that actually have an equal in AROS. If you have a keyboard with a key
33 * that isn't covered here, find its SDL key name in SDL/SDL_keysym.h, choose
34 * an appropriate AROS key to map it to from devices/rawkeycodes.h, and add a
35 * row to the table. The SDL "checkkeys" test program can help you to choose a
36 * SDL key */
38 static const struct keymap keymap[] = {
39 { SDLK_BACKSPACE, RAWKEY_BACKSPACE },
40 { SDLK_TAB, RAWKEY_TAB },
41 { SDLK_RETURN, RAWKEY_RETURN },
42 { SDLK_PAUSE, RAWKEY_PAUSE },
43 { SDLK_ESCAPE, RAWKEY_ESCAPE },
44 { SDLK_SPACE, RAWKEY_SPACE },
45 { SDLK_COMMA, RAWKEY_COMMA },
46 { SDLK_MINUS, RAWKEY_MINUS },
47 { SDLK_PERIOD, RAWKEY_PERIOD },
48 { SDLK_SLASH, RAWKEY_SLASH },
49 { SDLK_0, RAWKEY_0 },
50 { SDLK_1, RAWKEY_1 },
51 { SDLK_2, RAWKEY_2 },
52 { SDLK_3, RAWKEY_3 },
53 { SDLK_4, RAWKEY_4 },
54 { SDLK_5, RAWKEY_5 },
55 { SDLK_6, RAWKEY_6 },
56 { SDLK_7, RAWKEY_7 },
57 { SDLK_8, RAWKEY_8 },
58 { SDLK_9, RAWKEY_9 },
59 { SDLK_SEMICOLON, RAWKEY_SEMICOLON },
60 { SDLK_EQUALS, RAWKEY_EQUAL },
61 { SDLK_BACKSLASH, RAWKEY_BACKSLASH },
62 { SDLK_BACKQUOTE, RAWKEY_TILDE },
63 { SDLK_a, RAWKEY_A },
64 { SDLK_b, RAWKEY_B },
65 { SDLK_c, RAWKEY_C },
66 { SDLK_d, RAWKEY_D },
67 { SDLK_e, RAWKEY_E },
68 { SDLK_f, RAWKEY_F },
69 { SDLK_g, RAWKEY_G },
70 { SDLK_h, RAWKEY_H },
71 { SDLK_i, RAWKEY_I },
72 { SDLK_j, RAWKEY_J },
73 { SDLK_k, RAWKEY_K },
74 { SDLK_l, RAWKEY_L },
75 { SDLK_m, RAWKEY_M },
76 { SDLK_n, RAWKEY_N },
77 { SDLK_o, RAWKEY_O },
78 { SDLK_p, RAWKEY_P },
79 { SDLK_q, RAWKEY_Q },
80 { SDLK_r, RAWKEY_R },
81 { SDLK_s, RAWKEY_S },
82 { SDLK_t, RAWKEY_T },
83 { SDLK_u, RAWKEY_U },
84 { SDLK_v, RAWKEY_V },
85 { SDLK_w, RAWKEY_W },
86 { SDLK_x, RAWKEY_X },
87 { SDLK_y, RAWKEY_Y },
88 { SDLK_z, RAWKEY_Z },
89 { SDLK_DELETE, RAWKEY_DELETE },
90 { SDLK_KP0, RAWKEY_KP_0 },
91 { SDLK_KP1, RAWKEY_KP_1 },
92 { SDLK_KP2, RAWKEY_KP_2 },
93 { SDLK_KP3, RAWKEY_KP_3 },
94 { SDLK_KP4, RAWKEY_KP_4 },
95 { SDLK_KP5, RAWKEY_KP_5 },
96 { SDLK_KP6, RAWKEY_KP_6 },
97 { SDLK_KP7, RAWKEY_KP_7 },
98 { SDLK_KP8, RAWKEY_KP_8 },
99 { SDLK_KP9, RAWKEY_KP_9 },
100 { SDLK_KP_PERIOD, RAWKEY_KP_DECIMAL},
101 { SDLK_KP_PLUS, RAWKEY_KP_PLUS },
102 { SDLK_KP_ENTER, RAWKEY_KP_ENTER },
103 { SDLK_UP, RAWKEY_UP },
104 { SDLK_DOWN, RAWKEY_DOWN },
105 { SDLK_RIGHT, RAWKEY_RIGHT },
106 { SDLK_LEFT, RAWKEY_LEFT },
107 { SDLK_INSERT, RAWKEY_INSERT },
108 { SDLK_HOME, RAWKEY_HOME },
109 { SDLK_END, RAWKEY_END },
110 { SDLK_PAGEUP, RAWKEY_PAGEUP },
111 { SDLK_PAGEDOWN, RAWKEY_PAGEDOWN },
112 { SDLK_F1, RAWKEY_F1 },
113 { SDLK_F2, RAWKEY_F2 },
114 { SDLK_F3, RAWKEY_F3 },
115 { SDLK_F4, RAWKEY_F4 },
116 { SDLK_F5, RAWKEY_F5 },
117 { SDLK_F6, RAWKEY_F6 },
118 { SDLK_F7, RAWKEY_F7 },
119 { SDLK_F8, RAWKEY_F8 },
120 { SDLK_F9, RAWKEY_F9 },
121 { SDLK_F10, RAWKEY_F10 },
122 { SDLK_F11, RAWKEY_F11 },
123 { SDLK_F12, RAWKEY_F12 },
124 { SDLK_CAPSLOCK, RAWKEY_CAPSLOCK },
125 { SDLK_RSHIFT, RAWKEY_RSHIFT },
126 { SDLK_LSHIFT, RAWKEY_LSHIFT },
127 { SDLK_RCTRL, RAWKEY_CONTROL },
128 { SDLK_LCTRL, RAWKEY_LCONTROL },
129 { SDLK_RALT, RAWKEY_RALT },
130 { SDLK_LALT, RAWKEY_LALT },
131 { SDLK_RMETA, RAWKEY_RAMIGA },
132 { SDLK_LMETA, RAWKEY_LAMIGA },
133 { SDLK_LSUPER, RAWKEY_LAMIGA },
134 { SDLK_RSUPER, RAWKEY_RAMIGA },
135 { SDLK_HELP, RAWKEY_HELP },
136 { 0xff, 0xff }
139 void sdl_keymap_init(LIBBASETYPEPTR LIBBASE) {
140 int i;
141 const struct keymap *pair;
143 D(bug("[sdl] sdl_keymap_init\n"));
145 for (i = 0; i < SDLK_LAST; i++)
146 LIBBASE->keycode[i] = 0xff;
148 for (pair = keymap; pair->sdl != 0xff && pair->aros != 0xff; pair++)
149 LIBBASE->keycode[pair->sdl] = pair->aros;