Mercurial > sdl-ios-xcode
comparison src/video/ataricommon/SDL_gemdosevents.c @ 1209:a55ac374271c
Added preliminary missingtranslation from Atari to Unicode charset
author | Patrice Mandin <patmandin@gmail.com> |
---|---|
date | Sun, 01 Jan 2006 19:14:11 +0000 |
parents | b8d311d90021 |
children | 8ef3e7e92a91 |
comparison
equal
deleted
inserted
replaced
1208:d90b362628ea | 1209:a55ac374271c |
---|---|
39 #include "SDL.h" | 39 #include "SDL.h" |
40 #include "SDL_sysevents.h" | 40 #include "SDL_sysevents.h" |
41 #include "SDL_events_c.h" | 41 #include "SDL_events_c.h" |
42 | 42 |
43 #include "SDL_atarikeys.h" | 43 #include "SDL_atarikeys.h" |
44 #include "SDL_atarievents_c.h" | |
44 #include "SDL_xbiosevents_c.h" | 45 #include "SDL_xbiosevents_c.h" |
45 | 46 |
46 /* To save state of keyboard */ | 47 /* To save state of keyboard */ |
47 #define ATARIBIOS_MAXKEYS 128 | 48 #define ATARIBIOS_MAXKEYS 128 |
48 | 49 |
67 }; | 68 }; |
68 | 69 |
69 /* The translation tables from a console scancode to a SDL keysym */ | 70 /* The translation tables from a console scancode to a SDL keysym */ |
70 static SDLKey keymap[ATARIBIOS_MAXKEYS]; | 71 static SDLKey keymap[ATARIBIOS_MAXKEYS]; |
71 | 72 |
72 static SDL_keysym *TranslateKey(int scancode, int asciicode, SDL_keysym *keysym); | 73 static SDL_keysym *TranslateKey(int scancode, int asciicode, SDL_keysym *keysym, |
74 SDL_bool pressed); | |
73 static void UpdateSpecialKeys(int special_keys_state); | 75 static void UpdateSpecialKeys(int special_keys_state); |
74 | 76 |
75 void AtariGemdos_InitOSKeymap(_THIS) | 77 void AtariGemdos_InitOSKeymap(_THIS) |
76 { | 78 { |
77 int i; | 79 int i; |
138 | 140 |
139 /* Now generate events */ | 141 /* Now generate events */ |
140 for (i=0; i<ATARIBIOS_MAXKEYS; i++) { | 142 for (i=0; i<ATARIBIOS_MAXKEYS; i++) { |
141 /* Key pressed ? */ | 143 /* Key pressed ? */ |
142 if (gemdos_currentkeyboard[i] && !gemdos_previouskeyboard[i]) | 144 if (gemdos_currentkeyboard[i] && !gemdos_previouskeyboard[i]) |
143 SDL_PrivateKeyboard(SDL_PRESSED, TranslateKey(i, gemdos_currentascii[i], &keysym)); | 145 SDL_PrivateKeyboard(SDL_PRESSED, |
146 TranslateKey(i, gemdos_currentascii[i], &keysym, SDL_TRUE)); | |
144 | 147 |
145 /* Key unpressed ? */ | 148 /* Key unpressed ? */ |
146 if (gemdos_previouskeyboard[i] && !gemdos_currentkeyboard[i]) | 149 if (gemdos_previouskeyboard[i] && !gemdos_currentkeyboard[i]) |
147 SDL_PrivateKeyboard(SDL_RELEASED, TranslateKey(i, gemdos_currentascii[i], &keysym)); | 150 SDL_PrivateKeyboard(SDL_RELEASED, |
151 TranslateKey(i, gemdos_currentascii[i], &keysym, SDL_FALSE)); | |
148 } | 152 } |
149 | 153 |
150 SDL_AtariXbios_PostMouseEvents(this); | 154 SDL_AtariXbios_PostMouseEvents(this); |
151 | 155 |
152 /* Will be previous table */ | 156 /* Will be previous table */ |
168 UPDATE_SPECIAL_KEYS(K_CTRL, SCANCODE_LEFTCONTROL); | 172 UPDATE_SPECIAL_KEYS(K_CTRL, SCANCODE_LEFTCONTROL); |
169 UPDATE_SPECIAL_KEYS(K_ALT, SCANCODE_LEFTALT); | 173 UPDATE_SPECIAL_KEYS(K_ALT, SCANCODE_LEFTALT); |
170 UPDATE_SPECIAL_KEYS(K_CAPSLOCK, SCANCODE_CAPSLOCK); | 174 UPDATE_SPECIAL_KEYS(K_CAPSLOCK, SCANCODE_CAPSLOCK); |
171 } | 175 } |
172 | 176 |
173 static SDL_keysym *TranslateKey(int scancode, int asciicode, SDL_keysym *keysym) | 177 static SDL_keysym *TranslateKey(int scancode, int asciicode, SDL_keysym *keysym, |
178 SDL_bool pressed) | |
174 { | 179 { |
175 /* Set the keysym information */ | 180 /* Set the keysym information */ |
176 keysym->scancode = scancode; | 181 keysym->scancode = scancode; |
177 | 182 |
178 if (asciicode) | 183 if (asciicode) |
180 else | 185 else |
181 keysym->sym = keymap[scancode]; | 186 keysym->sym = keymap[scancode]; |
182 | 187 |
183 keysym->mod = KMOD_NONE; | 188 keysym->mod = KMOD_NONE; |
184 keysym->unicode = 0; | 189 keysym->unicode = 0; |
190 if (pressed && (asciicode!=0)) { | |
191 keysym->unicode = SDL_AtariToUnicode(asciicode); | |
192 } | |
185 | 193 |
186 return(keysym); | 194 return(keysym); |
187 } | 195 } |
188 | 196 |
189 void AtariGemdos_ShutdownEvents(void) | 197 void AtariGemdos_ShutdownEvents(void) |