Mercurial > sdl-ios-xcode
comparison src/video/gem/SDL_gemevents.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 | 1f37386ef508 |
children | 8ef3e7e92a91 |
comparison
equal
deleted
inserted
replaced
1208:d90b362628ea | 1209:a55ac374271c |
---|---|
42 #include "SDL_sysevents.h" | 42 #include "SDL_sysevents.h" |
43 #include "SDL_events_c.h" | 43 #include "SDL_events_c.h" |
44 #include "SDL_gemvideo.h" | 44 #include "SDL_gemvideo.h" |
45 #include "SDL_gemevents_c.h" | 45 #include "SDL_gemevents_c.h" |
46 #include "SDL_atarikeys.h" /* for keyboard scancodes */ | 46 #include "SDL_atarikeys.h" /* for keyboard scancodes */ |
47 #include "SDL_atarievents_c.h" | |
47 #include "SDL_xbiosinterrupt_s.h" | 48 #include "SDL_xbiosinterrupt_s.h" |
48 | 49 |
49 /* Defines */ | 50 /* Defines */ |
50 | 51 |
51 #define ATARIBIOS_MAXKEYS 128 | 52 #define ATARIBIOS_MAXKEYS 128 |
59 /* The translation tables from a console scancode to a SDL keysym */ | 60 /* The translation tables from a console scancode to a SDL keysym */ |
60 static SDLKey keymap[ATARIBIOS_MAXKEYS]; | 61 static SDLKey keymap[ATARIBIOS_MAXKEYS]; |
61 | 62 |
62 /* Functions prototypes */ | 63 /* Functions prototypes */ |
63 | 64 |
64 static SDL_keysym *TranslateKey(int scancode, int asciicode, SDL_keysym *keysym); | 65 static SDL_keysym *TranslateKey(int scancode, int asciicode, SDL_keysym *keysym, |
66 SDL_bool pressed); | |
65 static int do_messages(_THIS, short *message); | 67 static int do_messages(_THIS, short *message); |
66 static void do_keyboard(short kc, short ks); | 68 static void do_keyboard(short kc, short ks); |
67 static void do_mouse(_THIS, short mx, short my, short mb, short ks); | 69 static void do_mouse(_THIS, short mx, short my, short mb, short ks); |
68 | 70 |
69 /* Functions */ | 71 /* Functions */ |
70 | 72 |
71 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) | |
72 { | 75 { |
73 /* Set the keysym information */ | 76 /* Set the keysym information */ |
74 keysym->scancode = scancode; | 77 keysym->scancode = scancode; |
75 | 78 |
76 if (asciicode) | 79 if (asciicode) |
78 else | 81 else |
79 keysym->sym = keymap[scancode]; | 82 keysym->sym = keymap[scancode]; |
80 | 83 |
81 keysym->mod = KMOD_NONE; | 84 keysym->mod = KMOD_NONE; |
82 keysym->unicode = 0; | 85 keysym->unicode = 0; |
86 if (pressed && (asciicode!=0)) { | |
87 keysym->unicode = SDL_AtariToUnicode(asciicode); | |
88 } | |
83 | 89 |
84 return(keysym); | 90 return(keysym); |
85 } | 91 } |
86 | 92 |
87 void GEM_InitOSKeymap(_THIS) | 93 void GEM_InitOSKeymap(_THIS) |
203 | 209 |
204 /* Now generate keyboard events */ | 210 /* Now generate keyboard events */ |
205 for (i=0; i<ATARIBIOS_MAXKEYS; i++) { | 211 for (i=0; i<ATARIBIOS_MAXKEYS; i++) { |
206 /* Key pressed ? */ | 212 /* Key pressed ? */ |
207 if (gem_currentkeyboard[i] && !gem_previouskeyboard[i]) | 213 if (gem_currentkeyboard[i] && !gem_previouskeyboard[i]) |
208 SDL_PrivateKeyboard(SDL_PRESSED, TranslateKey(i, gem_currentascii[i], &keysym)); | 214 SDL_PrivateKeyboard(SDL_PRESSED, |
215 TranslateKey(i, gem_currentascii[i], &keysym, SDL_TRUE)); | |
209 | 216 |
210 /* Key unpressed ? */ | 217 /* Key unpressed ? */ |
211 if (gem_previouskeyboard[i] && !gem_currentkeyboard[i]) | 218 if (gem_previouskeyboard[i] && !gem_currentkeyboard[i]) |
212 SDL_PrivateKeyboard(SDL_RELEASED, TranslateKey(i, gem_currentascii[i], &keysym)); | 219 SDL_PrivateKeyboard(SDL_RELEASED, |
220 TranslateKey(i, gem_currentascii[i], &keysym, SDL_FALSE)); | |
213 } | 221 } |
214 | 222 |
215 memcpy(gem_previouskeyboard,gem_currentkeyboard,sizeof(gem_previouskeyboard)); | 223 memcpy(gem_previouskeyboard,gem_currentkeyboard,sizeof(gem_previouskeyboard)); |
216 | 224 |
217 /* Refresh window name ? */ | 225 /* Refresh window name ? */ |