equal
deleted
inserted
replaced
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_ikbdinterrupt_s.h" |
45 #include "SDL_ikbdinterrupt_s.h" |
45 |
46 |
46 /* Special keys state */ |
47 /* Special keys state */ |
47 enum { |
48 enum { |
48 K_RSHIFT=0, |
49 K_RSHIFT=0, |
73 static int caps_state; /* caps lock state */ |
74 static int caps_state; /* caps lock state */ |
74 _KEYTAB *curtables; |
75 _KEYTAB *curtables; |
75 static unsigned char *tab_unshift, *tab_shift, *tab_caps; |
76 static unsigned char *tab_unshift, *tab_shift, *tab_caps; |
76 static SDLKey keymap[ATARIBIOS_MAXKEYS]; |
77 static SDLKey keymap[ATARIBIOS_MAXKEYS]; |
77 |
78 |
78 static SDL_keysym *TranslateKey(int scancode, int numkeytable, SDL_keysym *keysym); |
79 static SDL_keysym *TranslateKey(int scancode, int numkeytable, SDL_keysym *keysym, |
|
80 SDL_bool pressed); |
79 |
81 |
80 void AtariIkbd_InitOSKeymap(_THIS) |
82 void AtariIkbd_InitOSKeymap(_THIS) |
81 { |
83 { |
82 int i; |
84 int i; |
83 |
85 |
169 |
171 |
170 /* Now generate events */ |
172 /* Now generate events */ |
171 for (i=0; i<ATARIBIOS_MAXKEYS; i++) { |
173 for (i=0; i<ATARIBIOS_MAXKEYS; i++) { |
172 /* Key pressed ? */ |
174 /* Key pressed ? */ |
173 if (SDL_AtariIkbd_keyboard[i]==KEY_PRESSED) { |
175 if (SDL_AtariIkbd_keyboard[i]==KEY_PRESSED) { |
174 SDL_PrivateKeyboard(SDL_PRESSED, TranslateKey(i, specialkeys, &keysym)); |
176 SDL_PrivateKeyboard(SDL_PRESSED, |
|
177 TranslateKey(i, specialkeys, &keysym, SDL_TRUE)); |
175 SDL_AtariIkbd_keyboard[i]=KEY_UNDEFINED; |
178 SDL_AtariIkbd_keyboard[i]=KEY_UNDEFINED; |
176 } |
179 } |
177 |
180 |
178 /* Key released ? */ |
181 /* Key released ? */ |
179 if (SDL_AtariIkbd_keyboard[i]==KEY_RELEASED) { |
182 if (SDL_AtariIkbd_keyboard[i]==KEY_RELEASED) { |
180 SDL_PrivateKeyboard(SDL_RELEASED, TranslateKey(i, specialkeys, &keysym)); |
183 SDL_PrivateKeyboard(SDL_RELEASED, |
|
184 TranslateKey(i, specialkeys, &keysym, SDL_FALSE)); |
181 SDL_AtariIkbd_keyboard[i]=KEY_UNDEFINED; |
185 SDL_AtariIkbd_keyboard[i]=KEY_UNDEFINED; |
182 } |
186 } |
183 } |
187 } |
184 |
188 |
185 /*--- Send mouse events ---*/ |
189 /*--- Send mouse events ---*/ |
207 } |
211 } |
208 atari_prevmouseb = SDL_AtariIkbd_mouseb; |
212 atari_prevmouseb = SDL_AtariIkbd_mouseb; |
209 } |
213 } |
210 } |
214 } |
211 |
215 |
212 static SDL_keysym *TranslateKey(int scancode, int numkeytable, SDL_keysym *keysym) |
216 static SDL_keysym *TranslateKey(int scancode, int numkeytable, SDL_keysym *keysym, |
|
217 SDL_bool pressed) |
213 { |
218 { |
214 unsigned char asciicode; |
219 unsigned char asciicode; |
215 |
220 |
216 /* Set the keysym information */ |
221 /* Set the keysym information */ |
217 keysym->scancode = scancode; |
222 keysym->scancode = scancode; |
234 else |
239 else |
235 keysym->sym = keymap[scancode]; |
240 keysym->sym = keymap[scancode]; |
236 |
241 |
237 keysym->mod = KMOD_NONE; |
242 keysym->mod = KMOD_NONE; |
238 keysym->unicode = 0; |
243 keysym->unicode = 0; |
|
244 if (pressed && (asciicode!=0)) { |
|
245 keysym->unicode = SDL_AtariToUnicode(asciicode); |
|
246 } |
239 |
247 |
240 return(keysym); |
248 return(keysym); |
241 } |
249 } |
242 |
250 |
243 void AtariIkbd_ShutdownEvents(void) |
251 void AtariIkbd_ShutdownEvents(void) |