comparison src/video/cybergfx/SDL_amigaevents.c @ 255:dcb5e869f8b5

Updated Amiga port by Gabriele Greco
author Sam Lantinga <slouken@libsdl.org>
date Sun, 16 Dec 2001 20:00:27 +0000
parents e8157fcb3114
children f6ffac90895c
comparison
equal deleted inserted replaced
254:4fc12b8edf74 255:dcb5e869f8b5
146 case IDCMP_INACTIVEWINDOW: 146 case IDCMP_INACTIVEWINDOW:
147 posted = SDL_PrivateAppActive(0, SDL_APPMOUSEFOCUS); 147 posted = SDL_PrivateAppActive(0, SDL_APPMOUSEFOCUS);
148 break; 148 break;
149 #if 0 149 #if 0
150 /* Gaining input focus? */ 150 /* Gaining input focus? */
151 case IDCMP_ACTIVEWINDOW: 151 case IDCMP_ACTIVEWINDOW:
152 posted = SDL_PrivateAppActive(1, SDL_APPINPUTFOCUS); 152 posted = SDL_PrivateAppActive(1, SDL_APPINPUTFOCUS);
153 153
154 /* Queue entry into fullscreen mode */ 154 /* Queue entry into fullscreen mode */
155 switch_waiting = 0x01 | SDL_FULLSCREEN; 155 switch_waiting = 0x01 | SDL_FULLSCREEN;
156 switch_time = SDL_GetTicks() + 1500; 156 switch_time = SDL_GetTicks() + 1500;
164 switch_waiting = 0x01; 164 switch_waiting = 0x01;
165 switch_time = SDL_GetTicks() + 200; 165 switch_time = SDL_GetTicks() + 200;
166 break; 166 break;
167 #endif 167 #endif
168 /* Mouse motion? */ 168 /* Mouse motion? */
169 case IDCMP_MOUSEMOVE: 169 case IDCMP_MOUSEMOVE:
170 if ( SDL_VideoSurface ) { 170 if ( SDL_VideoSurface ) {
171 posted = SDL_PrivateMouseMotion(0, 0, 171 posted = SDL_PrivateMouseMotion(0, 0,
172 msg->MouseX-SDL_Window->BorderLeft, 172 msg->MouseX-SDL_Window->BorderLeft,
173 msg->MouseY-SDL_Window->BorderTop); 173 msg->MouseY-SDL_Window->BorderTop);
174 } 174 }
177 /* Mouse button press? */ 177 /* Mouse button press? */
178 case IDCMP_MOUSEBUTTONS: 178 case IDCMP_MOUSEBUTTONS:
179 179
180 if(!(code&IECODE_UP_PREFIX)) 180 if(!(code&IECODE_UP_PREFIX))
181 { 181 {
182 posted = SDL_PrivateMouseButton(SDL_PRESSED, 182 posted = SDL_PrivateMouseButton(SDL_PRESSED,
183 amiga_GetButton(code), 0, 0); 183 amiga_GetButton(code), 0, 0);
184 } 184 }
185 /* Mouse button release? */ 185 /* Mouse button release? */
186 else 186 else
187 { 187 {
188 code&=~IECODE_UP_PREFIX; 188 code&=~IECODE_UP_PREFIX;
189 posted = SDL_PrivateMouseButton(SDL_RELEASED, 189 posted = SDL_PrivateMouseButton(SDL_RELEASED,
190 amiga_GetButton(code), 0, 0); 190 amiga_GetButton(code), 0, 0);
191 } 191 }
192 break; 192 break;
193 193
194 case IDCMP_RAWKEY: 194 case IDCMP_RAWKEY:
209 code&=~IECODE_UP_PREFIX; 209 code&=~IECODE_UP_PREFIX;
210 210
211 /* Check to see if this is a repeated key */ 211 /* Check to see if this is a repeated key */
212 /* if ( ! X11_KeyRepeat(SDL_Display, &xevent) ) */ 212 /* if ( ! X11_KeyRepeat(SDL_Display, &xevent) ) */
213 213
214 posted = SDL_PrivateKeyboard(SDL_RELEASED, 214 posted = SDL_PrivateKeyboard(SDL_RELEASED,
215 amiga_TranslateKey(code, &keysym)); 215 amiga_TranslateKey(code, &keysym));
216 } 216 }
217 break; 217 break;
218 /* Have we been iconified? */ 218 /* Have we been iconified? */
219 #if 0 219 #if 0
233 #endif 233 #endif
234 234
235 posted = SDL_PrivateAppActive(1, SDL_APPACTIVE); 235 posted = SDL_PrivateAppActive(1, SDL_APPACTIVE);
236 236
237 if ( SDL_VideoSurface && 237 if ( SDL_VideoSurface &&
238 (SDL_VideoSurface->flags & SDL_FULLSCREEN) ) 238 (SDL_VideoSurface->flags & SDL_FULLSCREEN) )
239 { 239 {
240 CGX_EnterFullScreen(this); 240 CGX_EnterFullScreen(this);
241 } else { 241 } else {
242 X11_GrabInputNoLock(this, this->input_grab); 242 X11_GrabInputNoLock(this, this->input_grab);
243 } 243 }
252 } 252 }
253 break; 253 break;
254 #endif 254 #endif
255 255
256 /* Have we been resized? */ 256 /* Have we been resized? */
257 case IDCMP_NEWSIZE: 257 case IDCMP_NEWSIZE:
258 SDL_PrivateResize(SDL_Window->Width-SDL_Window->BorderLeft-SDL_Window->BorderRight, 258 SDL_PrivateResize(SDL_Window->Width-SDL_Window->BorderLeft-SDL_Window->BorderRight,
259 SDL_Window->Height-SDL_Window->BorderTop-SDL_Window->BorderBottom); 259 SDL_Window->Height-SDL_Window->BorderTop-SDL_Window->BorderBottom);
260
260 break; 261 break;
261 262
262 /* Have we been requested to quit? */ 263 /* Have we been requested to quit? */
263 case IDCMP_CLOSEWINDOW: 264 case IDCMP_CLOSEWINDOW:
264 posted = SDL_PrivateQuit(); 265 posted = SDL_PrivateQuit();
426 MISC_keymap[95] = SDLK_HELP; 427 MISC_keymap[95] = SDLK_HELP;
427 } 428 }
428 429
429 SDL_keysym *amiga_TranslateKey(int code, SDL_keysym *keysym) 430 SDL_keysym *amiga_TranslateKey(int code, SDL_keysym *keysym)
430 { 431 {
432 #ifdef STORMC4_WOS
433 static struct Library *KeymapBase=NULL; /* Linking failed in WOS version if ConsoleDevice was used */
434 #else
431 static struct Library *ConsoleDevice=NULL; 435 static struct Library *ConsoleDevice=NULL;
436 #endif
432 437
433 /* Get the raw keyboard scancode */ 438 /* Get the raw keyboard scancode */
434 keysym->scancode = code; 439 keysym->scancode = code;
435 keysym->sym = MISC_keymap[code]; 440 keysym->sym = MISC_keymap[code];
436 441
437 #ifdef DEBUG_KEYS 442 #ifdef DEBUG_KEYS
438 fprintf(stderr, "Translating key 0x%.4x (%d)\n", xsym, xkey->keycode); 443 fprintf(stderr, "Translating key 0x%.4x (%d)\n", xsym, xkey->keycode);
439 #endif 444 #endif
440 /* Get the translated SDL virtual keysym */ 445 /* Get the translated SDL virtual keysym */
441 if ( keysym->sym==SDLK_UNKNOWN ) 446 if ( keysym->sym==SDLK_UNKNOWN )
442 { 447 {
448 #ifdef STORMC4_WOS
449 if(!KeymapBase)
450 #else
443 if(!ConsoleDevice) 451 if(!ConsoleDevice)
452 #endif
444 { 453 {
454 #ifdef STORMC4_WOS
455 KeymapBase=OpenLibrary("keymap.library", 0L);
456 #else
445 if(ConPort=CreateMsgPort()) 457 if(ConPort=CreateMsgPort())
446 { 458 {
447 if(ConReq=CreateIORequest(ConPort,sizeof(struct IOStdReq))) 459 if(ConReq=CreateIORequest(ConPort,sizeof(struct IOStdReq)))
448 { 460 {
449 if(!OpenDevice("console.device",-1,(struct IORequest *)ConReq,0)) 461 if(!OpenDevice("console.device",-1,(struct IORequest *)ConReq,0))
458 { 470 {
459 DeleteMsgPort(ConPort); 471 DeleteMsgPort(ConPort);
460 ConPort=NULL; 472 ConPort=NULL;
461 } 473 }
462 } 474 }
463 } 475 #endif
464 476 }
477
478 #ifdef STORMC4_WOS
479 if(KeymapBase)
480 #else
465 if(ConsoleDevice) 481 if(ConsoleDevice)
482 #endif
466 { 483 {
467 struct InputEvent event; 484 struct InputEvent event;
468 long actual; 485 long actual;
469 char buffer[5]; 486 char buffer[5];
470 487
475 event.ie_X=event.ie_Y=0; 492 event.ie_X=event.ie_Y=0;
476 event.ie_EventAddress=NULL; 493 event.ie_EventAddress=NULL;
477 event.ie_NextEvent=NULL; 494 event.ie_NextEvent=NULL;
478 event.ie_Prev1DownCode=event.ie_Prev1DownQual=event.ie_Prev2DownCode=event.ie_Prev2DownQual=0; 495 event.ie_Prev1DownCode=event.ie_Prev1DownQual=event.ie_Prev2DownCode=event.ie_Prev2DownQual=0;
479 496
497 #ifdef STORMC4_WOS
498 if( (actual=MapRawKey(&event,buffer,5,NULL))>=0)
499 #else
480 if( (actual=RawKeyConvert(&event,buffer,5,NULL))>=0) 500 if( (actual=RawKeyConvert(&event,buffer,5,NULL))>=0)
501 #endif
481 { 502 {
482 if(actual>1) 503 if(actual>1)
483 { 504 {
484 D(bug("Warning (%ld) character conversion!\n",actual)); 505 D(bug("Warning (%ld) character conversion!\n",actual));
485 } 506 }