Mercurial > sdl-ios-xcode
annotate src/video/vgl/SDL_vglevents.c @ 252:e8157fcb3114
Updated the source with the correct e-mail address
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Fri, 14 Dec 2001 12:38:15 +0000 |
parents | b0ae59d0f3ee |
children | c9b51268668f |
rev | line source |
---|---|
75
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
1 /* |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
2 SDL - Simple DirectMedia Layer |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
3 Copyright (C) 1997, 1998, 1999, 2000 Sam Lantinga |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
4 |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
6 modify it under the terms of the GNU Library General Public |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
7 License as published by the Free Software Foundation; either |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
8 version 2 of the License, or (at your option) any later version. |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
9 |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
13 Library General Public License for more details. |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
14 |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
15 You should have received a copy of the GNU Library General Public |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
16 License along with this library; if not, write to the Free |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
18 |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
19 Sam Lantinga |
252
e8157fcb3114
Updated the source with the correct e-mail address
Sam Lantinga <slouken@libsdl.org>
parents:
75
diff
changeset
|
20 slouken@libsdl.org |
75
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
21 */ |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
22 |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
23 #ifdef SAVE_RCSID |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
24 static char rcsid = |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
25 "@(#) $Id$"; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
26 #endif |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
27 |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
28 /* Handle the event stream, converting X11 events into SDL events */ |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
29 |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
30 #include <stdio.h> |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
31 |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
32 #include <sys/fbio.h> |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
33 #include <sys/consio.h> |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
34 #include <sys/kbio.h> |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
35 #include <vgl.h> |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
36 |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
37 #include "SDL.h" |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
38 #include "SDL_thread.h" |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
39 #include "SDL_sysevents.h" |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
40 #include "SDL_events_c.h" |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
41 #include "SDL_vglvideo.h" |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
42 #include "SDL_vglevents_c.h" |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
43 |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
44 /* The translation tables from a console scancode to a SDL keysym */ |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
45 /* FIXME: Free the keymap when we shut down the video mode */ |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
46 static keymap_t *vga_keymap = NULL; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
47 static SDLKey keymap[128]; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
48 static SDL_keysym *TranslateKey(int scancode, SDL_keysym *keysym); |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
49 |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
50 static int posted = 0; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
51 static int oldx = -1; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
52 static int oldy = -1; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
53 static struct mouse_info mouseinfo; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
54 |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
55 /* Ugh, we have to duplicate the kernel's keysym mapping code... |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
56 Oh, it's not so bad. :-) |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
57 |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
58 FIXME: Add keyboard LED handling code |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
59 */ |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
60 int VGL_initkeymaps(int fd) |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
61 { |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
62 vga_keymap = malloc(sizeof(keymap_t)); |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
63 if ( ! vga_keymap ) { |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
64 SDL_OutOfMemory(); |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
65 return(-1); |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
66 } |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
67 if (ioctl(fd, GIO_KEYMAP, vga_keymap) == -1) { |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
68 free(vga_keymap); |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
69 vga_keymap = NULL; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
70 SDL_SetError("Unable to get keyboard map"); |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
71 return(-1); |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
72 } |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
73 return(0); |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
74 } |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
75 |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
76 static void handle_keyboard(_THIS) |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
77 { |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
78 SDL_keysym keysym; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
79 int c, pressed, scancode; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
80 |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
81 while ((c = VGLKeyboardGetCh()) != 0) { |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
82 scancode = c & 0x7F; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
83 if (c & 0x80) { |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
84 pressed = SDL_RELEASED; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
85 } else { |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
86 pressed = SDL_PRESSED; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
87 } |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
88 |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
89 posted += SDL_PrivateKeyboard(pressed, |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
90 TranslateKey(scancode, &keysym)); |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
91 } |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
92 } |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
93 |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
94 int VGL_initmouse(int fd) |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
95 { |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
96 mouseinfo.operation = MOUSE_GETINFO; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
97 if (ioctl(fd, CONS_MOUSECTL, &mouseinfo) != 0) |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
98 return -1; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
99 |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
100 return 0; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
101 } |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
102 |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
103 static void handle_mouse(_THIS) |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
104 { |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
105 char buttons; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
106 int x, y; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
107 int button_state, state_changed, state; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
108 int i; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
109 |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
110 ioctl(0, CONS_MOUSECTL, &mouseinfo); |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
111 x = mouseinfo.u.data.x; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
112 y = mouseinfo.u.data.y; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
113 buttons = mouseinfo.u.data.buttons; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
114 |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
115 if ((x != oldx) || (y != oldy)) { |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
116 posted += SDL_PrivateMouseMotion(0, 0, x, y); |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
117 oldx = x; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
118 oldy = y; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
119 } |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
120 |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
121 /* See what's changed */ |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
122 button_state = SDL_GetMouseState(NULL, NULL); |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
123 state_changed = button_state ^ buttons; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
124 for (i = 0; i < 8; i++) { |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
125 if (state_changed & (1<<i)) { |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
126 if (buttons & (1<<i)) { |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
127 state = SDL_PRESSED; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
128 } else { |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
129 state = SDL_RELEASED; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
130 } |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
131 posted += SDL_PrivateMouseButton(state, i + 1, 0, 0); |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
132 } |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
133 } |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
134 } |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
135 |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
136 |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
137 void VGL_PumpEvents(_THIS) |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
138 { |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
139 do { |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
140 posted = 0; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
141 handle_keyboard(this); |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
142 handle_mouse(this); |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
143 } while (posted != 0); |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
144 } |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
145 |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
146 void VGL_InitOSKeymap(_THIS) |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
147 { |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
148 int i; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
149 |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
150 /* Initialize the BeOS key translation table */ |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
151 for ( i=0; i<SDL_TABLESIZE(keymap); ++i ) |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
152 keymap[i] = SDLK_UNKNOWN; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
153 |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
154 keymap[SCANCODE_ESCAPE] = SDLK_ESCAPE; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
155 keymap[SCANCODE_1] = SDLK_1; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
156 keymap[SCANCODE_2] = SDLK_2; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
157 keymap[SCANCODE_3] = SDLK_3; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
158 keymap[SCANCODE_4] = SDLK_4; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
159 keymap[SCANCODE_5] = SDLK_5; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
160 keymap[SCANCODE_6] = SDLK_6; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
161 keymap[SCANCODE_7] = SDLK_7; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
162 keymap[SCANCODE_8] = SDLK_8; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
163 keymap[SCANCODE_9] = SDLK_9; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
164 keymap[SCANCODE_0] = SDLK_0; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
165 keymap[SCANCODE_MINUS] = SDLK_MINUS; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
166 keymap[SCANCODE_EQUAL] = SDLK_EQUALS; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
167 keymap[SCANCODE_BACKSPACE] = SDLK_BACKSPACE; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
168 keymap[SCANCODE_TAB] = SDLK_TAB; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
169 keymap[SCANCODE_Q] = SDLK_q; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
170 keymap[SCANCODE_W] = SDLK_w; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
171 keymap[SCANCODE_E] = SDLK_e; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
172 keymap[SCANCODE_R] = SDLK_r; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
173 keymap[SCANCODE_T] = SDLK_t; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
174 keymap[SCANCODE_Y] = SDLK_y; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
175 keymap[SCANCODE_U] = SDLK_u; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
176 keymap[SCANCODE_I] = SDLK_i; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
177 keymap[SCANCODE_O] = SDLK_o; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
178 keymap[SCANCODE_P] = SDLK_p; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
179 keymap[SCANCODE_BRACKET_LEFT] = SDLK_LEFTBRACKET; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
180 keymap[SCANCODE_BRACKET_RIGHT] = SDLK_RIGHTBRACKET; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
181 keymap[SCANCODE_ENTER] = SDLK_RETURN; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
182 keymap[SCANCODE_LEFTCONTROL] = SDLK_LCTRL; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
183 keymap[SCANCODE_A] = SDLK_a; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
184 keymap[SCANCODE_S] = SDLK_s; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
185 keymap[SCANCODE_D] = SDLK_d; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
186 keymap[SCANCODE_F] = SDLK_f; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
187 keymap[SCANCODE_G] = SDLK_g; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
188 keymap[SCANCODE_H] = SDLK_h; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
189 keymap[SCANCODE_J] = SDLK_j; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
190 keymap[SCANCODE_K] = SDLK_k; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
191 keymap[SCANCODE_L] = SDLK_l; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
192 keymap[SCANCODE_SEMICOLON] = SDLK_SEMICOLON; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
193 keymap[SCANCODE_APOSTROPHE] = SDLK_QUOTE; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
194 keymap[SCANCODE_GRAVE] = SDLK_BACKQUOTE; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
195 keymap[SCANCODE_LEFTSHIFT] = SDLK_LSHIFT; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
196 keymap[SCANCODE_BACKSLASH] = SDLK_BACKSLASH; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
197 keymap[SCANCODE_Z] = SDLK_z; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
198 keymap[SCANCODE_X] = SDLK_x; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
199 keymap[SCANCODE_C] = SDLK_c; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
200 keymap[SCANCODE_V] = SDLK_v; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
201 keymap[SCANCODE_B] = SDLK_b; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
202 keymap[SCANCODE_N] = SDLK_n; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
203 keymap[SCANCODE_M] = SDLK_m; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
204 keymap[SCANCODE_COMMA] = SDLK_COMMA; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
205 keymap[SCANCODE_PERIOD] = SDLK_PERIOD; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
206 keymap[SCANCODE_SLASH] = SDLK_SLASH; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
207 keymap[SCANCODE_RIGHTSHIFT] = SDLK_RSHIFT; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
208 keymap[SCANCODE_KEYPADMULTIPLY] = SDLK_KP_MULTIPLY; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
209 keymap[SCANCODE_LEFTALT] = SDLK_LALT; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
210 keymap[SCANCODE_SPACE] = SDLK_SPACE; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
211 keymap[SCANCODE_CAPSLOCK] = SDLK_CAPSLOCK; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
212 keymap[SCANCODE_F1] = SDLK_F1; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
213 keymap[SCANCODE_F2] = SDLK_F2; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
214 keymap[SCANCODE_F3] = SDLK_F3; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
215 keymap[SCANCODE_F4] = SDLK_F4; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
216 keymap[SCANCODE_F5] = SDLK_F5; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
217 keymap[SCANCODE_F6] = SDLK_F6; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
218 keymap[SCANCODE_F7] = SDLK_F7; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
219 keymap[SCANCODE_F8] = SDLK_F8; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
220 keymap[SCANCODE_F9] = SDLK_F9; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
221 keymap[SCANCODE_F10] = SDLK_F10; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
222 keymap[SCANCODE_NUMLOCK] = SDLK_NUMLOCK; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
223 keymap[SCANCODE_SCROLLLOCK] = SDLK_SCROLLOCK; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
224 keymap[SCANCODE_KEYPAD7] = SDLK_KP7; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
225 keymap[SCANCODE_CURSORUPLEFT] = SDLK_KP7; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
226 keymap[SCANCODE_KEYPAD8] = SDLK_KP8; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
227 keymap[SCANCODE_CURSORUP] = SDLK_KP8; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
228 keymap[SCANCODE_KEYPAD9] = SDLK_KP9; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
229 keymap[SCANCODE_CURSORUPRIGHT] = SDLK_KP9; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
230 keymap[SCANCODE_KEYPADMINUS] = SDLK_KP_MINUS; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
231 keymap[SCANCODE_KEYPAD4] = SDLK_KP4; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
232 keymap[SCANCODE_CURSORLEFT] = SDLK_KP4; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
233 keymap[SCANCODE_KEYPAD5] = SDLK_KP5; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
234 keymap[SCANCODE_KEYPAD6] = SDLK_KP6; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
235 keymap[SCANCODE_CURSORRIGHT] = SDLK_KP6; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
236 keymap[SCANCODE_KEYPADPLUS] = SDLK_KP_PLUS; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
237 keymap[SCANCODE_KEYPAD1] = SDLK_KP1; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
238 keymap[SCANCODE_CURSORDOWNLEFT] = SDLK_KP1; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
239 keymap[SCANCODE_KEYPAD2] = SDLK_KP2; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
240 keymap[SCANCODE_CURSORDOWN] = SDLK_KP2; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
241 keymap[SCANCODE_KEYPAD3] = SDLK_KP3; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
242 keymap[SCANCODE_CURSORDOWNRIGHT] = SDLK_KP3; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
243 keymap[SCANCODE_KEYPAD0] = SDLK_KP0; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
244 keymap[SCANCODE_KEYPADPERIOD] = SDLK_KP_PERIOD; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
245 keymap[SCANCODE_LESS] = SDLK_LESS; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
246 keymap[SCANCODE_F11] = SDLK_F11; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
247 keymap[SCANCODE_F12] = SDLK_F12; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
248 keymap[SCANCODE_KEYPADENTER] = SDLK_KP_ENTER; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
249 keymap[SCANCODE_RIGHTCONTROL] = SDLK_RCTRL; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
250 keymap[SCANCODE_CONTROL] = SDLK_RCTRL; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
251 keymap[SCANCODE_KEYPADDIVIDE] = SDLK_KP_DIVIDE; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
252 keymap[SCANCODE_PRINTSCREEN] = SDLK_PRINT; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
253 keymap[SCANCODE_RIGHTALT] = SDLK_RALT; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
254 keymap[SCANCODE_BREAK] = SDLK_BREAK; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
255 keymap[SCANCODE_BREAK_ALTERNATIVE] = SDLK_UNKNOWN; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
256 keymap[SCANCODE_HOME] = SDLK_HOME; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
257 keymap[SCANCODE_CURSORBLOCKUP] = SDLK_UP; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
258 keymap[SCANCODE_PAGEUP] = SDLK_PAGEUP; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
259 keymap[SCANCODE_CURSORBLOCKLEFT] = SDLK_LEFT; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
260 keymap[SCANCODE_CURSORBLOCKRIGHT] = SDLK_RIGHT; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
261 keymap[SCANCODE_END] = SDLK_END; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
262 keymap[SCANCODE_CURSORBLOCKDOWN] = SDLK_DOWN; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
263 keymap[SCANCODE_PAGEDOWN] = SDLK_PAGEDOWN; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
264 keymap[SCANCODE_INSERT] = SDLK_INSERT; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
265 keymap[SCANCODE_REMOVE] = SDLK_DELETE; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
266 keymap[119] = SDLK_PAUSE; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
267 keymap[SCANCODE_RIGHTWIN] = SDLK_RSUPER; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
268 keymap[SCANCODE_LEFTWIN] = SDLK_LSUPER; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
269 keymap[127] = SDLK_MENU; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
270 } |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
271 |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
272 static SDL_keysym *TranslateKey(int scancode, SDL_keysym *keysym) |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
273 { |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
274 /* Set the keysym information */ |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
275 keysym->scancode = scancode; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
276 keysym->sym = keymap[scancode]; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
277 keysym->mod = KMOD_NONE; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
278 |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
279 /* If UNICODE is on, get the UNICODE value for the key */ |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
280 keysym->unicode = 0; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
281 if ( SDL_TranslateUNICODE && vga_keymap ) { |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
282 int map; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
283 SDLMod modstate; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
284 |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
285 modstate = SDL_GetModState(); |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
286 map = 0; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
287 if ( modstate & KMOD_SHIFT ) { |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
288 map += 1; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
289 } |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
290 if ( modstate & KMOD_CTRL ) { |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
291 map += 2; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
292 } |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
293 if ( modstate & KMOD_ALT ) { |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
294 map += 4; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
295 } |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
296 if ( !(vga_keymap->key[scancode].spcl & (0x80 >> map)) ) { |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
297 keysym->unicode = vga_keymap->key[scancode].map[map]; |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
298 } |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
299 |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
300 } |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
301 return(keysym); |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
302 } |
b0ae59d0f3ee
Added patches from FreeBSD ports
Sam Lantinga <slouken@lokigames.com>
parents:
diff
changeset
|
303 |