Mercurial > sdl-ios-xcode
comparison src/video/directfb/SDL_DirectFB_events.c @ 464:1c4be4a16410
Date: Fri, 23 Aug 2002 11:48:56 +0200
From: Denis Oliver Kropp
Subject: Another patch
this is another patch fixing key code mapping
along with some other fixes and better mode handling.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 24 Aug 2002 15:29:06 +0000 |
parents | 276d0d7ba96c |
children | b8d311d90021 |
comparison
equal
deleted
inserted
replaced
463:bf7389310d27 | 464:1c4be4a16410 |
---|---|
98 | 98 |
99 /* Initialize the DirectFB key translation table */ | 99 /* Initialize the DirectFB key translation table */ |
100 for (i=0; i<SDL_TABLESIZE(keymap); ++i) | 100 for (i=0; i<SDL_TABLESIZE(keymap); ++i) |
101 keymap[i] = SDLK_UNKNOWN; | 101 keymap[i] = SDLK_UNKNOWN; |
102 | 102 |
103 keymap[DIKI_A] = SDLK_a; | 103 keymap[DIKI_A - DIKI_UNKNOWN] = SDLK_a; |
104 keymap[DIKI_B] = SDLK_b; | 104 keymap[DIKI_B - DIKI_UNKNOWN] = SDLK_b; |
105 keymap[DIKI_C] = SDLK_c; | 105 keymap[DIKI_C - DIKI_UNKNOWN] = SDLK_c; |
106 keymap[DIKI_D] = SDLK_d; | 106 keymap[DIKI_D - DIKI_UNKNOWN] = SDLK_d; |
107 keymap[DIKI_E] = SDLK_e; | 107 keymap[DIKI_E - DIKI_UNKNOWN] = SDLK_e; |
108 keymap[DIKI_F] = SDLK_f; | 108 keymap[DIKI_F - DIKI_UNKNOWN] = SDLK_f; |
109 keymap[DIKI_G] = SDLK_g; | 109 keymap[DIKI_G - DIKI_UNKNOWN] = SDLK_g; |
110 keymap[DIKI_H] = SDLK_h; | 110 keymap[DIKI_H - DIKI_UNKNOWN] = SDLK_h; |
111 keymap[DIKI_I] = SDLK_i; | 111 keymap[DIKI_I - DIKI_UNKNOWN] = SDLK_i; |
112 keymap[DIKI_J] = SDLK_j; | 112 keymap[DIKI_J - DIKI_UNKNOWN] = SDLK_j; |
113 keymap[DIKI_K] = SDLK_k; | 113 keymap[DIKI_K - DIKI_UNKNOWN] = SDLK_k; |
114 keymap[DIKI_L] = SDLK_l; | 114 keymap[DIKI_L - DIKI_UNKNOWN] = SDLK_l; |
115 keymap[DIKI_M] = SDLK_m; | 115 keymap[DIKI_M - DIKI_UNKNOWN] = SDLK_m; |
116 keymap[DIKI_N] = SDLK_n; | 116 keymap[DIKI_N - DIKI_UNKNOWN] = SDLK_n; |
117 keymap[DIKI_O] = SDLK_o; | 117 keymap[DIKI_O - DIKI_UNKNOWN] = SDLK_o; |
118 keymap[DIKI_P] = SDLK_p; | 118 keymap[DIKI_P - DIKI_UNKNOWN] = SDLK_p; |
119 keymap[DIKI_Q] = SDLK_q; | 119 keymap[DIKI_Q - DIKI_UNKNOWN] = SDLK_q; |
120 keymap[DIKI_R] = SDLK_r; | 120 keymap[DIKI_R - DIKI_UNKNOWN] = SDLK_r; |
121 keymap[DIKI_S] = SDLK_s; | 121 keymap[DIKI_S - DIKI_UNKNOWN] = SDLK_s; |
122 keymap[DIKI_T] = SDLK_t; | 122 keymap[DIKI_T - DIKI_UNKNOWN] = SDLK_t; |
123 keymap[DIKI_U] = SDLK_u; | 123 keymap[DIKI_U - DIKI_UNKNOWN] = SDLK_u; |
124 keymap[DIKI_V] = SDLK_v; | 124 keymap[DIKI_V - DIKI_UNKNOWN] = SDLK_v; |
125 keymap[DIKI_W] = SDLK_w; | 125 keymap[DIKI_W - DIKI_UNKNOWN] = SDLK_w; |
126 keymap[DIKI_X] = SDLK_x; | 126 keymap[DIKI_X - DIKI_UNKNOWN] = SDLK_x; |
127 keymap[DIKI_Y] = SDLK_y; | 127 keymap[DIKI_Y - DIKI_UNKNOWN] = SDLK_y; |
128 keymap[DIKI_Z] = SDLK_z; | 128 keymap[DIKI_Z - DIKI_UNKNOWN] = SDLK_z; |
129 | 129 |
130 keymap[DIKI_0] = SDLK_0; | 130 keymap[DIKI_0 - DIKI_UNKNOWN] = SDLK_0; |
131 keymap[DIKI_1] = SDLK_1; | 131 keymap[DIKI_1 - DIKI_UNKNOWN] = SDLK_1; |
132 keymap[DIKI_2] = SDLK_2; | 132 keymap[DIKI_2 - DIKI_UNKNOWN] = SDLK_2; |
133 keymap[DIKI_3] = SDLK_3; | 133 keymap[DIKI_3 - DIKI_UNKNOWN] = SDLK_3; |
134 keymap[DIKI_4] = SDLK_4; | 134 keymap[DIKI_4 - DIKI_UNKNOWN] = SDLK_4; |
135 keymap[DIKI_5] = SDLK_5; | 135 keymap[DIKI_5 - DIKI_UNKNOWN] = SDLK_5; |
136 keymap[DIKI_6] = SDLK_6; | 136 keymap[DIKI_6 - DIKI_UNKNOWN] = SDLK_6; |
137 keymap[DIKI_7] = SDLK_7; | 137 keymap[DIKI_7 - DIKI_UNKNOWN] = SDLK_7; |
138 keymap[DIKI_8] = SDLK_8; | 138 keymap[DIKI_8 - DIKI_UNKNOWN] = SDLK_8; |
139 keymap[DIKI_9] = SDLK_9; | 139 keymap[DIKI_9 - DIKI_UNKNOWN] = SDLK_9; |
140 | 140 |
141 keymap[DIKI_F1] = SDLK_F1; | 141 keymap[DIKI_F1 - DIKI_UNKNOWN] = SDLK_F1; |
142 keymap[DIKI_F2] = SDLK_F2; | 142 keymap[DIKI_F2 - DIKI_UNKNOWN] = SDLK_F2; |
143 keymap[DIKI_F3] = SDLK_F3; | 143 keymap[DIKI_F3 - DIKI_UNKNOWN] = SDLK_F3; |
144 keymap[DIKI_F4] = SDLK_F4; | 144 keymap[DIKI_F4 - DIKI_UNKNOWN] = SDLK_F4; |
145 keymap[DIKI_F5] = SDLK_F5; | 145 keymap[DIKI_F5 - DIKI_UNKNOWN] = SDLK_F5; |
146 keymap[DIKI_F6] = SDLK_F6; | 146 keymap[DIKI_F6 - DIKI_UNKNOWN] = SDLK_F6; |
147 keymap[DIKI_F7] = SDLK_F7; | 147 keymap[DIKI_F7 - DIKI_UNKNOWN] = SDLK_F7; |
148 keymap[DIKI_F8] = SDLK_F8; | 148 keymap[DIKI_F8 - DIKI_UNKNOWN] = SDLK_F8; |
149 keymap[DIKI_F9] = SDLK_F9; | 149 keymap[DIKI_F9 - DIKI_UNKNOWN] = SDLK_F9; |
150 keymap[DIKI_F10] = SDLK_F10; | 150 keymap[DIKI_F10 - DIKI_UNKNOWN] = SDLK_F10; |
151 keymap[DIKI_F11] = SDLK_F11; | 151 keymap[DIKI_F11 - DIKI_UNKNOWN] = SDLK_F11; |
152 keymap[DIKI_F12] = SDLK_F12; | 152 keymap[DIKI_F12 - DIKI_UNKNOWN] = SDLK_F12; |
153 | 153 |
154 keymap[DIKI_ESCAPE] = SDLK_ESCAPE; | 154 keymap[DIKI_ESCAPE - DIKI_UNKNOWN] = SDLK_ESCAPE; |
155 keymap[DIKI_LEFT] = SDLK_LEFT; | 155 keymap[DIKI_LEFT - DIKI_UNKNOWN] = SDLK_LEFT; |
156 keymap[DIKI_RIGHT] = SDLK_RIGHT; | 156 keymap[DIKI_RIGHT - DIKI_UNKNOWN] = SDLK_RIGHT; |
157 keymap[DIKI_UP] = SDLK_UP; | 157 keymap[DIKI_UP - DIKI_UNKNOWN] = SDLK_UP; |
158 keymap[DIKI_DOWN] = SDLK_DOWN; | 158 keymap[DIKI_DOWN - DIKI_UNKNOWN] = SDLK_DOWN; |
159 keymap[DIKI_CONTROL_L] = SDLK_LCTRL; | 159 keymap[DIKI_CONTROL_L - DIKI_UNKNOWN] = SDLK_LCTRL; |
160 keymap[DIKI_CONTROL_R] = SDLK_RCTRL; | 160 keymap[DIKI_CONTROL_R - DIKI_UNKNOWN] = SDLK_RCTRL; |
161 keymap[DIKI_SHIFT_L] = SDLK_LSHIFT; | 161 keymap[DIKI_SHIFT_L - DIKI_UNKNOWN] = SDLK_LSHIFT; |
162 keymap[DIKI_SHIFT_R] = SDLK_RSHIFT; | 162 keymap[DIKI_SHIFT_R - DIKI_UNKNOWN] = SDLK_RSHIFT; |
163 keymap[DIKI_ALT_L] = SDLK_LALT; | 163 keymap[DIKI_ALT_L - DIKI_UNKNOWN] = SDLK_LALT; |
164 keymap[DIKI_ALTGR] = SDLK_RALT; | 164 keymap[DIKI_ALTGR - DIKI_UNKNOWN] = SDLK_RALT; |
165 keymap[DIKI_TAB] = SDLK_TAB; | 165 keymap[DIKI_TAB - DIKI_UNKNOWN] = SDLK_TAB; |
166 keymap[DIKI_ENTER] = SDLK_RETURN; | 166 keymap[DIKI_ENTER - DIKI_UNKNOWN] = SDLK_RETURN; |
167 keymap[DIKI_SPACE] = SDLK_SPACE; | 167 keymap[DIKI_SPACE - DIKI_UNKNOWN] = SDLK_SPACE; |
168 keymap[DIKI_BACKSPACE] = SDLK_BACKSPACE; | 168 keymap[DIKI_BACKSPACE - DIKI_UNKNOWN] = SDLK_BACKSPACE; |
169 keymap[DIKI_INSERT] = SDLK_INSERT; | 169 keymap[DIKI_INSERT - DIKI_UNKNOWN] = SDLK_INSERT; |
170 keymap[DIKI_DELETE] = SDLK_DELETE; | 170 keymap[DIKI_DELETE - DIKI_UNKNOWN] = SDLK_DELETE; |
171 keymap[DIKI_HOME] = SDLK_HOME; | 171 keymap[DIKI_HOME - DIKI_UNKNOWN] = SDLK_HOME; |
172 keymap[DIKI_END] = SDLK_END; | 172 keymap[DIKI_END - DIKI_UNKNOWN] = SDLK_END; |
173 keymap[DIKI_PAGE_UP] = SDLK_PAGEUP; | 173 keymap[DIKI_PAGE_UP - DIKI_UNKNOWN] = SDLK_PAGEUP; |
174 keymap[DIKI_PAGE_DOWN] = SDLK_PAGEDOWN; | 174 keymap[DIKI_PAGE_DOWN - DIKI_UNKNOWN] = SDLK_PAGEDOWN; |
175 keymap[DIKI_CAPS_LOCK] = SDLK_CAPSLOCK; | 175 keymap[DIKI_CAPS_LOCK - DIKI_UNKNOWN] = SDLK_CAPSLOCK; |
176 keymap[DIKI_NUM_LOCK] = SDLK_NUMLOCK; | 176 keymap[DIKI_NUM_LOCK - DIKI_UNKNOWN] = SDLK_NUMLOCK; |
177 keymap[DIKI_SCROLL_LOCK] = SDLK_SCROLLOCK; | 177 keymap[DIKI_SCROLL_LOCK - DIKI_UNKNOWN] = SDLK_SCROLLOCK; |
178 keymap[DIKI_PRINT] = SDLK_PRINT; | 178 keymap[DIKI_PRINT - DIKI_UNKNOWN] = SDLK_PRINT; |
179 keymap[DIKI_PAUSE] = SDLK_PAUSE; | 179 keymap[DIKI_PAUSE - DIKI_UNKNOWN] = SDLK_PAUSE; |
180 keymap[DIKI_KP_DIV] = SDLK_KP_DIVIDE; | 180 keymap[DIKI_KP_DIV - DIKI_UNKNOWN] = SDLK_KP_DIVIDE; |
181 keymap[DIKI_KP_MULT] = SDLK_KP_MULTIPLY; | 181 keymap[DIKI_KP_MULT - DIKI_UNKNOWN] = SDLK_KP_MULTIPLY; |
182 keymap[DIKI_KP_MINUS] = SDLK_KP_MINUS; | 182 keymap[DIKI_KP_MINUS - DIKI_UNKNOWN] = SDLK_KP_MINUS; |
183 keymap[DIKI_KP_PLUS] = SDLK_KP_PLUS; | 183 keymap[DIKI_KP_PLUS - DIKI_UNKNOWN] = SDLK_KP_PLUS; |
184 keymap[DIKI_KP_ENTER] = SDLK_KP_ENTER; | 184 keymap[DIKI_KP_ENTER - DIKI_UNKNOWN] = SDLK_KP_ENTER; |
185 } | 185 } |
186 | 186 |
187 | 187 |
188 static SDL_keysym *DirectFB_TranslateKey (DFBInputEvent *ev, SDL_keysym *keysym) | 188 static SDL_keysym *DirectFB_TranslateKey (DFBInputEvent *ev, SDL_keysym *keysym) |
189 { | 189 { |
193 keysym->unicode = (DFB_KEY_TYPE (ev->key_symbol) == DIKT_UNICODE) ? ev->key_symbol : 0; | 193 keysym->unicode = (DFB_KEY_TYPE (ev->key_symbol) == DIKT_UNICODE) ? ev->key_symbol : 0; |
194 | 194 |
195 if (ev->key_symbol > 0 && ev->key_symbol < 128) | 195 if (ev->key_symbol > 0 && ev->key_symbol < 128) |
196 keysym->sym = ev->key_symbol; | 196 keysym->sym = ev->key_symbol; |
197 else | 197 else |
198 keysym->sym = keymap[ev->key_id]; | 198 keysym->sym = keymap[ev->key_id - DIKI_UNKNOWN]; |
199 | 199 |
200 return keysym; | 200 return keysym; |
201 } | 201 } |
202 | 202 |
203 static int DirectFB_TranslateButton (DFBInputEvent *ev) | 203 static int DirectFB_TranslateButton (DFBInputEvent *ev) |