comparison src/video/ataricommon/SDL_gemdosevents.c @ 1420:2405517b5eab

Added preliminary support for MiNT /dev/mouse driver (disabled atm)
author Patrice Mandin <patmandin@gmail.com>
date Thu, 23 Feb 2006 21:51:10 +0000
parents d910939febfa
children 782fd950bd46 c121d94672cb f1816773a309
comparison
equal deleted inserted replaced
1419:36a5068bf7df 1420:2405517b5eab
35 #include "../../events/SDL_events_c.h" 35 #include "../../events/SDL_events_c.h"
36 36
37 #include "SDL_atarikeys.h" 37 #include "SDL_atarikeys.h"
38 #include "SDL_atarievents_c.h" 38 #include "SDL_atarievents_c.h"
39 #include "SDL_xbiosevents_c.h" 39 #include "SDL_xbiosevents_c.h"
40 #include "SDL_ataridevmouse_c.h"
40 41
41 /* To save state of keyboard */ 42 /* To save state of keyboard */
42 #define ATARIBIOS_MAXKEYS 128 43 #define ATARIBIOS_MAXKEYS 128
43 44
44 static unsigned char gemdos_currentkeyboard[ATARIBIOS_MAXKEYS]; 45 static unsigned char gemdos_currentkeyboard[ATARIBIOS_MAXKEYS];
45 static unsigned char gemdos_previouskeyboard[ATARIBIOS_MAXKEYS]; 46 static unsigned char gemdos_previouskeyboard[ATARIBIOS_MAXKEYS];
46 static unsigned char gemdos_currentascii[ATARIBIOS_MAXKEYS]; 47 static unsigned char gemdos_currentascii[ATARIBIOS_MAXKEYS];
48 static SDL_bool use_dev_mouse = SDL_FALSE;
47 49
48 /* Special keys state */ 50 /* Special keys state */
49 enum { 51 enum {
50 K_RSHIFT=0, 52 K_RSHIFT=0,
51 K_LSHIFT, 53 K_LSHIFT,
104 keymap[SCANCODE_LEFTSHIFT] = SDLK_LSHIFT; 106 keymap[SCANCODE_LEFTSHIFT] = SDLK_LSHIFT;
105 keymap[SCANCODE_RIGHTSHIFT] = SDLK_RSHIFT; 107 keymap[SCANCODE_RIGHTSHIFT] = SDLK_RSHIFT;
106 keymap[SCANCODE_LEFTALT] = SDLK_LALT; 108 keymap[SCANCODE_LEFTALT] = SDLK_LALT;
107 keymap[SCANCODE_CAPSLOCK] = SDLK_CAPSLOCK; 109 keymap[SCANCODE_CAPSLOCK] = SDLK_CAPSLOCK;
108 110
109 vectors_mask = ATARI_XBIOS_MOUSEEVENTS|ATARI_XBIOS_JOYSTICKEVENTS; 111 use_dev_mouse = (SDL_AtariDevMouse_Open()!=0) ? SDL_TRUE : SDL_FALSE;
112
113 vectors_mask = ATARI_XBIOS_JOYSTICKEVENTS; /* XBIOS joystick events */
114 if (!use_dev_mouse) {
115 vectors_mask |= ATARI_XBIOS_MOUSEEVENTS; /* XBIOS mouse events */
116 }
110 if (Getcookie(C_MiNT, &dummy)==C_FOUND) { 117 if (Getcookie(C_MiNT, &dummy)==C_FOUND) {
111 vectors_mask = 0; 118 vectors_mask = 0;
112 } 119 }
113
114 SDL_AtariXbios_InstallVectors(vectors_mask); 120 SDL_AtariXbios_InstallVectors(vectors_mask);
115 } 121 }
116 122
117 void AtariGemdos_PumpEvents(_THIS) 123 void AtariGemdos_PumpEvents(_THIS)
118 { 124 {
149 if (gemdos_previouskeyboard[i] && !gemdos_currentkeyboard[i]) 155 if (gemdos_previouskeyboard[i] && !gemdos_currentkeyboard[i])
150 SDL_PrivateKeyboard(SDL_RELEASED, 156 SDL_PrivateKeyboard(SDL_RELEASED,
151 TranslateKey(i, gemdos_currentascii[i], &keysym, SDL_FALSE)); 157 TranslateKey(i, gemdos_currentascii[i], &keysym, SDL_FALSE));
152 } 158 }
153 159
154 SDL_AtariXbios_PostMouseEvents(this, SDL_TRUE); 160 if (use_dev_mouse) {
161 SDL_AtariDevMouse_PostMouseEvents(this, SDL_TRUE);
162 } else {
163 SDL_AtariXbios_PostMouseEvents(this, SDL_TRUE);
164 }
155 165
156 /* Will be previous table */ 166 /* Will be previous table */
157 SDL_memcpy(gemdos_previouskeyboard, gemdos_currentkeyboard, ATARIBIOS_MAXKEYS); 167 SDL_memcpy(gemdos_previouskeyboard, gemdos_currentkeyboard, ATARIBIOS_MAXKEYS);
158 } 168 }
159 169
195 } 205 }
196 206
197 void AtariGemdos_ShutdownEvents(void) 207 void AtariGemdos_ShutdownEvents(void)
198 { 208 {
199 SDL_AtariXbios_RestoreVectors(); 209 SDL_AtariXbios_RestoreVectors();
200 } 210 if (use_dev_mouse) {
211 SDL_AtariDevMouse_Close();
212 }
213 }