comparison src/video/photon/SDL_photon_input.c @ 3108:aa1897bee1e9

Continue working on QNX Photon with OpenGL ES support
author Mike Gorchak <lestat@i.com.ua>
date Tue, 28 Apr 2009 04:30:52 +0000
parents
children 1102a3305928
comparison
equal deleted inserted replaced
3107:3cf236d3cd81 3108:aa1897bee1e9
1 /*
2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997-2009 Sam Lantinga
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
19 Sam Lantinga
20 slouken@libsdl.org
21
22 QNX Photon GUI SDL driver
23 Copyright (C) 2009 Mike Gorchak
24 (mike@malva.ua, lestat@i.com.ua)
25 */
26
27 #include "SDL_photon_input.h"
28
29 #include "SDL_config.h"
30 #include "SDL_events.h"
31 #include "../../events/SDL_mouse_c.h"
32 #include "../../events/SDL_keyboard_c.h"
33
34 #include "SDL_photon_keycodes.h"
35
36 /* Mouse related functions */
37 SDL_Cursor* photon_createcursor(SDL_Surface* surface, int hot_x, int hot_y);
38 int photon_showcursor(SDL_Cursor* cursor);
39 void photon_movecursor(SDL_Cursor* cursor);
40 void photon_freecursor(SDL_Cursor* cursor);
41 void photon_warpmouse(SDL_Mouse* mouse, SDL_WindowID windowID, int x, int y);
42 void photon_freemouse(SDL_Mouse* mouse);
43
44 int32_t photon_addinputdevices(_THIS)
45 {
46 SDL_VideoData* phdata=(SDL_VideoData*)_this->driverdata;
47 SDL_DisplayData* didata=NULL;
48 struct SDL_Mouse photon_mouse;
49 SDL_MouseData* mdata=NULL;
50 SDL_Keyboard photon_keyboard;
51 SDLKey keymap[SDL_NUM_SCANCODES];
52 uint32_t it;
53
54 for (it=0; it<_this->num_displays; it++)
55 {
56 /* Clear SDL mouse structure */
57 SDL_memset(&photon_mouse, 0x00, sizeof(struct SDL_Mouse));
58
59 /* Allocate SDL_MouseData structure */
60 mdata=(SDL_MouseData*)SDL_calloc(1, sizeof(SDL_MouseData));
61 if (mdata==NULL)
62 {
63 SDL_OutOfMemory();
64 return -1;
65 }
66
67 /* Mark this mouse with ID 0 */
68 photon_mouse.id=it;
69 photon_mouse.driverdata=(void*)mdata;
70 photon_mouse.CreateCursor=photon_createcursor;
71 photon_mouse.ShowCursor=photon_showcursor;
72 photon_mouse.MoveCursor=photon_movecursor;
73 photon_mouse.FreeCursor=photon_freecursor;
74 photon_mouse.WarpMouse=photon_warpmouse;
75 photon_mouse.FreeMouse=photon_freemouse;
76
77 /* Get display data */
78 didata=(SDL_DisplayData*)_this->displays[it].driverdata;
79
80 /* Store SDL_DisplayData pointer in the mouse driver internals */
81 mdata->didata=didata;
82
83 /* Register mouse cursor in SDL */
84 SDL_AddMouse(&photon_mouse, "Photon mouse cursor", 0, 0, 1);
85 }
86
87 /* Photon maps all keyboards to one */
88 SDL_zero(photon_keyboard);
89 SDL_AddKeyboard(&photon_keyboard, -1);
90
91 /* Add default scancode to key mapping */
92 SDL_GetDefaultKeymap(keymap);
93 SDL_SetKeymap(0, 0, keymap, SDL_NUM_SCANCODES);
94
95 return 0;
96 }
97
98 int32_t photon_delinputdevices(_THIS)
99 {
100 /* Destroy all of the mice */
101 SDL_MouseQuit();
102 }
103
104 /*****************************************************************************/
105 /* Photon mouse related functions */
106 /*****************************************************************************/
107 SDL_Cursor* photon_createcursor(SDL_Surface* surface, int hot_x, int hot_y)
108 {
109 PhCursorDef_t* internal_cursor;
110 SDL_Cursor* sdl_cursor;
111 uint8_t* image0=NULL;
112 uint8_t* image1=NULL;
113 uint32_t it;
114 uint32_t jt;
115 uint32_t shape_color;
116
117 /* SDL converts monochrome cursor shape to 32bpp cursor shape */
118 /* and we must convert it back to monochrome, this routine handles */
119 /* 24/32bpp surfaces only */
120 if ((surface->format->BitsPerPixel!=32) && (surface->format->BitsPerPixel!=24))
121 {
122 SDL_SetError("Photon: Cursor shape is not 24/32bpp.");
123 return NULL;
124 }
125
126 /* Checking data parameters */
127 if ((surface->w==0) || (surface->h==0))
128 {
129 SDL_SetError("Photon: Cursor shape dimensions are zero");
130 return NULL;
131 }
132
133 /* Allocate memory for the internal cursor format */
134 internal_cursor=(PhCursorDef_t*)SDL_calloc(1, sizeof(PhCursorDef_t)+
135 ((((surface->w+7)>>3)*surface->h)*2)-1);
136 if (internal_cursor==NULL)
137 {
138 SDL_OutOfMemory();
139 return NULL;
140 }
141
142 /* Allocate memory for the SDL cursor */
143 sdl_cursor=(SDL_Cursor*)SDL_calloc(1, sizeof(SDL_Cursor));
144 if (sdl_cursor==NULL)
145 {
146 SDL_free(internal_cursor);
147 SDL_OutOfMemory();
148 return NULL;
149 }
150
151 /* Set driverdata as photon cursor format */
152 image0=(uint8_t*)internal_cursor;
153 image0+=sizeof(PhCursorDef_t)-1;
154 image1=image0;
155 image1+=((surface->w+7)>>3)*surface->h;
156 sdl_cursor->driverdata=(void*)internal_cursor;
157 internal_cursor->hdr.len=(sizeof(PhCursorDef_t)-sizeof(PhRegionDataHdr_t))+
158 ((((surface->w+7)>>3)*surface->h)*2)-1;
159 internal_cursor->hdr.type=Ph_RDATA_CURSOR;
160 internal_cursor->size1.x=surface->w;
161 internal_cursor->size1.y=surface->h;
162 internal_cursor->size2.x=surface->w;
163 internal_cursor->size2.y=surface->h;
164 internal_cursor->offset1.x=hot_x;
165 internal_cursor->offset1.y=hot_y;
166 internal_cursor->offset2.x=hot_x;
167 internal_cursor->offset2.y=hot_y;
168 internal_cursor->bytesperline1=((surface->w+7)>>3);
169 internal_cursor->bytesperline2=((surface->w+7)>>3);
170 internal_cursor->color1=(SDL_PHOTON_MOUSE_COLOR_BLACK) & 0x00FFFFFF;
171 internal_cursor->color2=(SDL_PHOTON_MOUSE_COLOR_WHITE) & 0x00FFFFFF;
172
173 /* Convert cursor from 32 bpp */
174 for (jt=0; jt<surface->h; jt++)
175 {
176 for (it=0; it<surface->w; it++)
177 {
178 shape_color=*((uint32_t*)((uint8_t*)surface->pixels+jt*surface->pitch+it*surface->format->BytesPerPixel));
179 switch(shape_color)
180 {
181 case SDL_PHOTON_MOUSE_COLOR_BLACK:
182 {
183 *(image0+jt*(internal_cursor->bytesperline1)+(it>>3))|=0x80>>(it%8);
184 *(image1+jt*(internal_cursor->bytesperline2)+(it>>3))&=~(0x80>>(it%8));
185 }
186 break;
187 case SDL_PHOTON_MOUSE_COLOR_WHITE:
188 {
189 *(image0+jt*(internal_cursor->bytesperline1)+(it>>3))&=~(0x80>>(it%8));
190 *(image1+jt*(internal_cursor->bytesperline2)+(it>>3))|=0x80>>(it%8);
191 }
192 break;
193 case SDL_PHOTON_MOUSE_COLOR_TRANS:
194 {
195 *(image0+jt*(internal_cursor->bytesperline1)+(it>>3))&=~(0x80>>(it%8));
196 *(image1+jt*(internal_cursor->bytesperline2)+(it>>3))&=~(0x80>>(it%8));
197 }
198 break;
199 default:
200 {
201 /* The same as transparent color, must not happen */
202 *(image0+jt*(internal_cursor->bytesperline1)+(it>>3))&=~(0x80>>(it%8));
203 *(image1+jt*(internal_cursor->bytesperline2)+(it>>3))&=~(0x80>>(it%8));
204 }
205 break;
206 }
207 }
208 }
209
210 return sdl_cursor;
211 }
212
213 int photon_showcursor(SDL_Cursor* cursor)
214 {
215 SDL_VideoDisplay* display;
216 SDL_DisplayData* didata;
217 SDL_Window* window;
218 SDL_WindowData* wdata;
219 SDL_WindowID window_id;
220 PhCursorDef_t* internal_cursor;
221 int32_t status;
222
223 /* Get current window id */
224 window_id=SDL_GetFocusWindow();
225 if (window_id<=0)
226 {
227 SDL_MouseData* mdata=NULL;
228
229 /* If there is no current window, then someone calls this function */
230 /* to set global mouse settings during SDL initialization */
231 if (cursor!=NULL)
232 {
233 /* Store cursor for future usage */
234 mdata=(SDL_MouseData*)cursor->mouse->driverdata;
235 didata=(SDL_DisplayData*)mdata->didata;
236 internal_cursor=(PhCursorDef_t*)cursor->driverdata;
237
238 if (didata->cursor_size>=(internal_cursor->hdr.len+sizeof(PhRegionDataHdr_t)))
239 {
240 SDL_memcpy(didata->cursor, internal_cursor, internal_cursor->hdr.len+sizeof(PhRegionDataHdr_t));
241 }
242 else
243 {
244 /* Partitial cursor image */
245 SDL_memcpy(didata->cursor, internal_cursor, didata->cursor_size);
246 }
247
248 didata->cursor_visible=SDL_TRUE;
249 return 0;
250 }
251 else
252 {
253 /* We can't get SDL_DisplayData at this point, return fake success */
254 return 0;
255 }
256 }
257 else
258 {
259 /* Sanity checks */
260 window=SDL_GetWindowFromID(window_id);
261 if (window!=NULL)
262 {
263 display=SDL_GetDisplayFromWindow(window);
264 if (display!=NULL)
265 {
266 didata=(SDL_DisplayData*)display->driverdata;
267 if (didata!=NULL)
268 {
269 wdata=(SDL_WindowData*)window->driverdata;
270 if (wdata==NULL)
271 {
272 return -1;
273 }
274 }
275 else
276 {
277 return -1;
278 }
279 }
280 else
281 {
282 return -1;
283 }
284 }
285 else
286 {
287 return -1;
288 }
289 }
290
291 /* return if window widget has been destroyed already */
292 if (wdata->window==NULL)
293 {
294 return;
295 }
296
297 /* Check if we need to set new shape or disable cursor shape */
298 if (cursor!=NULL)
299 {
300 /* Retrieve photon cursor shape */
301 internal_cursor=(PhCursorDef_t*)cursor->driverdata;
302 if (internal_cursor==NULL)
303 {
304 SDL_SetError("Photon: Internal cursor data is absent");
305 return -1;
306 }
307
308 /* Setup cursor type */
309 status=PtSetResource(wdata->window, Pt_ARG_CURSOR_TYPE, Ph_CURSOR_BITMAP, 0);
310 if (status!=0)
311 {
312 SDL_SetError("Photon: Failed to set cursor type to bitmap");
313 return -1;
314 }
315
316 /* Setup cursor color to default */
317 status=PtSetResource(wdata->window, Pt_ARG_CURSOR_COLOR, Ph_CURSOR_DEFAULT_COLOR, 0);
318 if (status!=0)
319 {
320 SDL_SetError("Photon: Failed to set cursor color");
321 return -1;
322 }
323
324 /* Setup cursor shape */
325 status=PtSetResource(wdata->window, Pt_ARG_BITMAP_CURSOR, internal_cursor,
326 internal_cursor->hdr.len+sizeof(PhRegionDataHdr_t));
327 if (status!=0)
328 {
329 SDL_SetError("Photon: Failed to set cursor color");
330 return -1;
331 }
332
333 /* Store current cursor for future usage */
334 if (didata->cursor_size>=(internal_cursor->hdr.len+sizeof(PhRegionDataHdr_t)))
335 {
336 SDL_memcpy(didata->cursor, internal_cursor, internal_cursor->hdr.len+sizeof(PhRegionDataHdr_t));
337 }
338 else
339 {
340 /* Partitial cursor image */
341 SDL_memcpy(didata->cursor, internal_cursor, didata->cursor_size);
342 }
343
344 /* Set cursor visible */
345 didata->cursor_visible=SDL_TRUE;
346 }
347 else
348 {
349 /* SDL requests to disable cursor */
350 status=PtSetResource(wdata->window, Pt_ARG_CURSOR_TYPE, Ph_CURSOR_NONE, 0);
351 if (status!=0)
352 {
353 SDL_SetError("Photon: Can't disable cursor");
354 return -1;
355 }
356
357 /* Set cursor invisible */
358 didata->cursor_visible=SDL_FALSE;
359 }
360
361 /* Flush all pending widget data */
362 PtFlush();
363
364 /* New cursor shape is set */
365 return 0;
366 }
367
368 void photon_movecursor(SDL_Cursor* cursor)
369 {
370 SDL_VideoDisplay* display;
371 SDL_DisplayData* didata;
372 SDL_Window* window;
373 SDL_WindowID window_id;
374 int32_t status;
375
376 /* Get current window id */
377 window_id=SDL_GetFocusWindow();
378 if (window_id<=0)
379 {
380 didata=(SDL_DisplayData*)cursor->mouse->driverdata;
381 }
382 else
383 {
384 /* Sanity checks */
385 window=SDL_GetWindowFromID(window_id);
386 if (window!=NULL)
387 {
388 display=SDL_GetDisplayFromWindow(window);
389 if (display!=NULL)
390 {
391 didata=(SDL_DisplayData*)display->driverdata;
392 if (didata==NULL)
393 {
394 return;
395 }
396 }
397 else
398 {
399 return;
400 }
401 }
402 else
403 {
404 return;
405 }
406 }
407
408 /* cursor->mouse->x, cursor->mouse->y */
409 }
410
411 void photon_freecursor(SDL_Cursor* cursor)
412 {
413 PhCursorDef_t* internal_cursor=NULL;
414
415 if (cursor!=NULL)
416 {
417 internal_cursor=(PhCursorDef_t*)cursor->driverdata;
418 if (internal_cursor!=NULL)
419 {
420 SDL_free(internal_cursor);
421 cursor->driverdata=NULL;
422 }
423 }
424 }
425
426 void photon_warpmouse(SDL_Mouse* mouse, SDL_WindowID windowID, int x, int y)
427 {
428 SDL_VideoDisplay* display;
429 SDL_DisplayData* didata;
430 SDL_Window* window;
431 int32_t status;
432
433 /* Sanity checks */
434 window=SDL_GetWindowFromID(windowID);
435 if (window!=NULL)
436 {
437 display=SDL_GetDisplayFromWindow(window);
438 if (display!=NULL)
439 {
440 didata=(SDL_DisplayData*)display->driverdata;
441 if (didata==NULL)
442 {
443 return;
444 }
445 }
446 else
447 {
448 return;
449 }
450 }
451 else
452 {
453 return;
454 }
455
456 }
457
458 void photon_freemouse(SDL_Mouse* mouse)
459 {
460 if (mouse->driverdata==NULL)
461 {
462 return;
463 }
464
465 /* Mouse framework doesn't deletes automatically our driverdata */
466 SDL_free(mouse->driverdata);
467 mouse->driverdata=NULL;
468
469 return;
470 }
471
472 SDL_scancode photon_to_sdl_keymap(uint32_t key)
473 {
474 SDL_scancode scancode=SDL_SCANCODE_UNKNOWN;
475
476 switch(key & 0x0000007F)
477 {
478 case PHOTON_SCANCODE_ESCAPE:
479 scancode=SDL_SCANCODE_ESCAPE;
480 break;
481 case PHOTON_SCANCODE_F1:
482 scancode=SDL_SCANCODE_F1;
483 break;
484 case PHOTON_SCANCODE_F2:
485 scancode=SDL_SCANCODE_F2;
486 break;
487 case PHOTON_SCANCODE_F3:
488 scancode=SDL_SCANCODE_F3;
489 break;
490 case PHOTON_SCANCODE_F4:
491 scancode=SDL_SCANCODE_F4;
492 break;
493 case PHOTON_SCANCODE_F5:
494 scancode=SDL_SCANCODE_F5;
495 break;
496 case PHOTON_SCANCODE_F6:
497 scancode=SDL_SCANCODE_F6;
498 break;
499 case PHOTON_SCANCODE_F7:
500 scancode=SDL_SCANCODE_F7;
501 break;
502 case PHOTON_SCANCODE_F8:
503 scancode=SDL_SCANCODE_F8;
504 break;
505 case PHOTON_SCANCODE_F9:
506 scancode=SDL_SCANCODE_F9;
507 break;
508 case PHOTON_SCANCODE_F10:
509 scancode=SDL_SCANCODE_F10;
510 break;
511 case PHOTON_SCANCODE_F11:
512 scancode=SDL_SCANCODE_F11;
513 break;
514 case PHOTON_SCANCODE_F12:
515 scancode=SDL_SCANCODE_F12;
516 break;
517 case PHOTON_SCANCODE_BACKQOUTE:
518 scancode=SDL_SCANCODE_GRAVE;
519 break;
520 case PHOTON_SCANCODE_1:
521 scancode=SDL_SCANCODE_1;
522 break;
523 case PHOTON_SCANCODE_2:
524 scancode=SDL_SCANCODE_2;
525 break;
526 case PHOTON_SCANCODE_3:
527 scancode=SDL_SCANCODE_3;
528 break;
529 case PHOTON_SCANCODE_4:
530 scancode=SDL_SCANCODE_4;
531 break;
532 case PHOTON_SCANCODE_5:
533 scancode=SDL_SCANCODE_5;
534 break;
535 case PHOTON_SCANCODE_6:
536 scancode=SDL_SCANCODE_6;
537 break;
538 case PHOTON_SCANCODE_7:
539 scancode=SDL_SCANCODE_7;
540 break;
541 case PHOTON_SCANCODE_8:
542 scancode=SDL_SCANCODE_8;
543 break;
544 case PHOTON_SCANCODE_9:
545 scancode=SDL_SCANCODE_9;
546 break;
547 case PHOTON_SCANCODE_0:
548 scancode=SDL_SCANCODE_0;
549 break;
550 case PHOTON_SCANCODE_MINUS:
551 scancode=SDL_SCANCODE_MINUS;
552 break;
553 case PHOTON_SCANCODE_EQUAL:
554 scancode=SDL_SCANCODE_EQUALS;
555 break;
556 case PHOTON_SCANCODE_BACKSPACE:
557 scancode=SDL_SCANCODE_BACKSPACE;
558 break;
559 case PHOTON_SCANCODE_TAB:
560 scancode=SDL_SCANCODE_TAB;
561 break;
562 case PHOTON_SCANCODE_Q:
563 scancode=SDL_SCANCODE_Q;
564 break;
565 case PHOTON_SCANCODE_W:
566 scancode=SDL_SCANCODE_W;
567 break;
568 case PHOTON_SCANCODE_E:
569 scancode=SDL_SCANCODE_E;
570 break;
571 case PHOTON_SCANCODE_R:
572 scancode=SDL_SCANCODE_R;
573 break;
574 case PHOTON_SCANCODE_T:
575 scancode=SDL_SCANCODE_T;
576 break;
577 case PHOTON_SCANCODE_Y:
578 scancode=SDL_SCANCODE_Y;
579 break;
580 case PHOTON_SCANCODE_U:
581 scancode=SDL_SCANCODE_U;
582 break;
583 case PHOTON_SCANCODE_I:
584 scancode=SDL_SCANCODE_I;
585 break;
586 case PHOTON_SCANCODE_O:
587 scancode=SDL_SCANCODE_O;
588 break;
589 case PHOTON_SCANCODE_P:
590 scancode=SDL_SCANCODE_P;
591 break;
592 case PHOTON_SCANCODE_LEFT_SQ_BR:
593 scancode=SDL_SCANCODE_LEFTBRACKET;
594 break;
595 case PHOTON_SCANCODE_RIGHT_SQ_BR:
596 scancode=SDL_SCANCODE_RIGHTBRACKET;
597 break;
598 case PHOTON_SCANCODE_ENTER:
599 scancode=SDL_SCANCODE_RETURN;
600 break;
601 case PHOTON_SCANCODE_CAPSLOCK:
602 scancode=SDL_SCANCODE_CAPSLOCK;
603 break;
604 case PHOTON_SCANCODE_A:
605 scancode=SDL_SCANCODE_A;
606 break;
607 case PHOTON_SCANCODE_S:
608 scancode=SDL_SCANCODE_S;
609 break;
610 case PHOTON_SCANCODE_D:
611 scancode=SDL_SCANCODE_D;
612 break;
613 case PHOTON_SCANCODE_F:
614 scancode=SDL_SCANCODE_F;
615 break;
616 case PHOTON_SCANCODE_G:
617 scancode=SDL_SCANCODE_G;
618 break;
619 case PHOTON_SCANCODE_H:
620 scancode=SDL_SCANCODE_H;
621 break;
622 case PHOTON_SCANCODE_J:
623 scancode=SDL_SCANCODE_J;
624 break;
625 case PHOTON_SCANCODE_K:
626 scancode=SDL_SCANCODE_K;
627 break;
628 case PHOTON_SCANCODE_L:
629 scancode=SDL_SCANCODE_L;
630 break;
631 case PHOTON_SCANCODE_SEMICOLON:
632 scancode=SDL_SCANCODE_SEMICOLON;
633 break;
634 case PHOTON_SCANCODE_QUOTE:
635 scancode=SDL_SCANCODE_APOSTROPHE;
636 break;
637 case PHOTON_SCANCODE_BACKSLASH:
638 scancode=SDL_SCANCODE_BACKSLASH;
639 break;
640 case PHOTON_SCANCODE_LEFT_SHIFT:
641 scancode=SDL_SCANCODE_LSHIFT;
642 break;
643 case PHOTON_SCANCODE_Z:
644 scancode=SDL_SCANCODE_Z;
645 break;
646 case PHOTON_SCANCODE_X:
647 scancode=SDL_SCANCODE_X;
648 break;
649 case PHOTON_SCANCODE_C:
650 scancode=SDL_SCANCODE_C;
651 break;
652 case PHOTON_SCANCODE_V:
653 scancode=SDL_SCANCODE_V;
654 break;
655 case PHOTON_SCANCODE_B:
656 scancode=SDL_SCANCODE_B;
657 break;
658 case PHOTON_SCANCODE_N:
659 scancode=SDL_SCANCODE_N;
660 break;
661 case PHOTON_SCANCODE_M:
662 scancode=SDL_SCANCODE_M;
663 break;
664 case PHOTON_SCANCODE_COMMA:
665 scancode=SDL_SCANCODE_COMMA;
666 break;
667 case PHOTON_SCANCODE_POINT:
668 scancode=SDL_SCANCODE_PERIOD;
669 break;
670 case PHOTON_SCANCODE_SLASH:
671 scancode=SDL_SCANCODE_SLASH;
672 break;
673 case PHOTON_SCANCODE_RIGHT_SHIFT:
674 scancode=SDL_SCANCODE_RSHIFT;
675 break;
676 case PHOTON_SCANCODE_CTRL:
677 scancode=SDL_SCANCODE_LCTRL;
678 break;
679 case PHOTON_SCANCODE_WFLAG:
680 scancode=SDL_SCANCODE_LGUI;
681 break;
682 case PHOTON_SCANCODE_ALT:
683 scancode=SDL_SCANCODE_LALT;
684 break;
685 case PHOTON_SCANCODE_SPACE:
686 scancode=SDL_SCANCODE_SPACE;
687 break;
688 case PHOTON_SCANCODE_MENU:
689 scancode=SDL_SCANCODE_MENU;
690 break;
691 case PHOTON_SCANCODE_PRNSCR:
692 scancode=SDL_SCANCODE_PRINTSCREEN;
693 break;
694 case PHOTON_SCANCODE_SCROLLLOCK:
695 scancode=SDL_SCANCODE_SCROLLLOCK;
696 break;
697 case PHOTON_SCANCODE_INSERT:
698 scancode=SDL_SCANCODE_INSERT;
699 break;
700 case PHOTON_SCANCODE_HOME:
701 scancode=SDL_SCANCODE_HOME;
702 break;
703 case PHOTON_SCANCODE_PAGEUP:
704 scancode=SDL_SCANCODE_PAGEUP;
705 break;
706 case PHOTON_SCANCODE_DELETE:
707 scancode=SDL_SCANCODE_DELETE;
708 break;
709 case PHOTON_SCANCODE_END:
710 scancode=SDL_SCANCODE_END;
711 break;
712 case PHOTON_SCANCODE_PAGEDOWN:
713 scancode=SDL_SCANCODE_PAGEDOWN;
714 break;
715 case PHOTON_SCANCODE_UP:
716 scancode=SDL_SCANCODE_UP;
717 break;
718 case PHOTON_SCANCODE_DOWN:
719 scancode=SDL_SCANCODE_DOWN;
720 break;
721 case PHOTON_SCANCODE_LEFT:
722 scancode=SDL_SCANCODE_LEFT;
723 break;
724 case PHOTON_SCANCODE_RIGHT:
725 scancode=SDL_SCANCODE_RIGHT;
726 break;
727 case PHOTON_SCANCODE_NUMLOCK:
728 scancode=SDL_SCANCODE_NUMLOCKCLEAR;
729 break;
730 default:
731 break;
732 }
733
734 return scancode;
735 }