Mercurial > sdl-ios-xcode
comparison src/video/ggi/SDL_ggievents.c @ 1662:782fd950bd46 SDL-1.3
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
WARNING: None of the video drivers have been updated for the new API yet! The API is still under design and very fluid.
The code is now run through a consistent indent format:
indent -i4 -nut -nsc -br -ce
The headers are being converted to automatically generate doxygen documentation.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 28 May 2006 13:04:16 +0000 |
parents | d910939febfa |
children | 4da1ee79c9af |
comparison
equal
deleted
inserted
replaced
1661:281d3f4870e5 | 1662:782fd950bd46 |
---|---|
40 #include "SDL_ggivideo.h" | 40 #include "SDL_ggivideo.h" |
41 #include "SDL_ggievents_c.h" | 41 #include "SDL_ggievents_c.h" |
42 | 42 |
43 /* The translation tables from a GGI keycode to a SDL keysym */ | 43 /* The translation tables from a GGI keycode to a SDL keysym */ |
44 static SDLKey keymap[128]; | 44 static SDLKey keymap[128]; |
45 static SDL_keysym *GGI_TranslateKey(ggi_event *ev, SDL_keysym *keysym); | 45 static SDL_keysym *GGI_TranslateKey (ggi_event * ev, SDL_keysym * keysym); |
46 | 46 |
47 static int posted = 0; | 47 static int posted = 0; |
48 | 48 |
49 void GGI_PumpEvents(_THIS) | 49 void |
50 GGI_PumpEvents (_THIS) | |
50 { | 51 { |
51 struct timeval *tvp, tv = { 0, 0 }; | 52 struct timeval *tvp, tv = { 0, 0 }; |
52 ggi_event ev; | 53 ggi_event ev; |
53 | 54 |
54 tvp = &tv; | 55 tvp = &tv; |
55 | 56 |
56 /* ggiFlush(VIS); */ | 57 /* ggiFlush(VIS); */ |
57 | 58 |
58 while (ggiEventPoll(VIS, emAll, tvp)) | 59 while (ggiEventPoll (VIS, emAll, tvp)) |
59 /* while (ggiEventPoll(VIS, (emKeyboard | emPointer | emCommand), tvp)) */ | 60 /* while (ggiEventPoll(VIS, (emKeyboard | emPointer | emCommand), tvp)) */ |
60 { | 61 { |
61 int queueevent_mouse = 0, queueevent_kbd = 0; | 62 int queueevent_mouse = 0, queueevent_kbd = 0; |
62 static int buttons = 0; | 63 static int buttons = 0; |
63 static int mouse_x = 0, mouse_y = 0, mouse_z = 0; | 64 static int mouse_x = 0, mouse_y = 0, mouse_z = 0; |
64 int x = 0, y = 0, z = 0, rx = 0, ry = 0, rz = 0; | 65 int x = 0, y = 0, z = 0, rx = 0, ry = 0, rz = 0; |
65 uint32 sym; | 66 uint32 sym; |
66 int pressed_mouse, pressed_kbd; | 67 int pressed_mouse, pressed_kbd; |
67 SDL_keysym keysym; | 68 SDL_keysym keysym; |
68 | 69 |
69 posted = 0; | 70 posted = 0; |
70 | 71 |
71 /* FIXME: We do not actually want all events, only | 72 /* FIXME: We do not actually want all events, only |
72 * mouse and keyboard events. Having to handle all | 73 * mouse and keyboard events. Having to handle all |
73 * events will slow things down. */ | 74 * events will slow things down. */ |
74 | 75 |
75 ggiEventRead(VIS, &ev, emAll); | 76 ggiEventRead (VIS, &ev, emAll); |
76 /* ggiEventRead(VIS, &ev, (emKeyboard | emPointer | emCommand)); */ | 77 /* ggiEventRead(VIS, &ev, (emKeyboard | emPointer | emCommand)); */ |
77 | 78 |
78 switch (ev.any.type) | 79 switch (ev.any.type) { |
79 { | 80 case evPtrRelative: |
80 case evPtrRelative: | 81 x = ev.pmove.x; |
81 x = ev.pmove.x; | 82 y = ev.pmove.y; |
82 y = ev.pmove.y; | 83 z = ev.pmove.wheel; |
83 z = ev.pmove.wheel; | 84 posted += SDL_PrivateMouseMotion (0, 1, x, y); |
84 posted += SDL_PrivateMouseMotion(0, 1, x, y); | 85 break; |
85 break; | 86 case evPtrAbsolute: |
86 case evPtrAbsolute: | 87 if (mouse_x != ev.pmove.x || mouse_y != ev.pmove.y |
87 if (mouse_x != ev.pmove.x || mouse_y != ev.pmove.y || mouse_z != ev.pmove.wheel) | 88 || mouse_z != ev.pmove.wheel) { |
88 { | 89 x = ev.pmove.x - mouse_x; |
89 x = ev.pmove.x - mouse_x; | 90 y = ev.pmove.y - mouse_y; |
90 y = ev.pmove.y - mouse_y; | 91 z = ev.pmove.wheel - mouse_z; |
91 z = ev.pmove.wheel - mouse_z; | 92 mouse_x = ev.pmove.x; |
92 mouse_x = ev.pmove.x; | 93 mouse_y = ev.pmove.y; |
93 mouse_y = ev.pmove.y; | 94 mouse_z = ev.pmove.wheel; |
94 mouse_z = ev.pmove.wheel; | 95 posted += SDL_PrivateMouseMotion (0, 1, x, y); |
95 posted += SDL_PrivateMouseMotion(0, 1, x, y); | 96 } |
96 } | 97 break; |
97 break; | 98 case evPtrButtonPress: |
98 case evPtrButtonPress: | 99 posted += |
99 posted += SDL_PrivateMouseButton(SDL_PRESSED, ev.pbutton.button, 0, 0); | 100 SDL_PrivateMouseButton (SDL_PRESSED, ev.pbutton.button, 0, 0); |
100 break; | 101 break; |
101 case evPtrButtonRelease: | 102 case evPtrButtonRelease: |
102 posted += SDL_PrivateMouseButton(SDL_RELEASED, ev.pbutton.button, 0, 0); | 103 posted += |
103 break; | 104 SDL_PrivateMouseButton (SDL_RELEASED, ev.pbutton.button, |
104 case evKeyPress: | 105 0, 0); |
105 case evKeyRepeat: | 106 break; |
106 posted += SDL_PrivateKeyboard(SDL_PRESSED, GGI_TranslateKey(&ev, &keysym)); | 107 case evKeyPress: |
107 break; | 108 case evKeyRepeat: |
108 case evKeyRelease: | 109 posted += |
109 posted += SDL_PrivateKeyboard(SDL_RELEASED, GGI_TranslateKey(&ev, &keysym)); | 110 SDL_PrivateKeyboard (SDL_PRESSED, |
110 break; | 111 GGI_TranslateKey (&ev, &keysym)); |
111 case evCommand: | 112 break; |
112 fprintf(stderr, "Command event %x recieved\n", ev.cmd.code); | 113 case evKeyRelease: |
113 break; | 114 posted += |
114 default: | 115 SDL_PrivateKeyboard (SDL_RELEASED, |
115 fprintf(stderr, "Unhandled event type %d\n", ev.any.type); | 116 GGI_TranslateKey (&ev, &keysym)); |
116 break; | 117 break; |
117 } | 118 case evCommand: |
118 } | 119 fprintf (stderr, "Command event %x recieved\n", ev.cmd.code); |
120 break; | |
121 default: | |
122 fprintf (stderr, "Unhandled event type %d\n", ev.any.type); | |
123 break; | |
124 } | |
125 } | |
119 | 126 |
120 } | 127 } |
121 | 128 |
122 void GGI_InitOSKeymap(_THIS) | 129 void |
130 GGI_InitOSKeymap (_THIS) | |
123 { | 131 { |
124 int i; | 132 int i; |
125 | 133 |
126 /* Initialize the GGI key translation table */ | 134 /* Initialize the GGI key translation table */ |
127 for ( i=0; i<SDL_arraysize(keymap); ++i ) | 135 for (i = 0; i < SDL_arraysize (keymap); ++i) |
128 keymap[i] = SDLK_UNKNOWN; | 136 keymap[i] = SDLK_UNKNOWN; |
129 | 137 |
130 keymap[SCANCODE_ESCAPE] = SDLK_ESCAPE; | 138 keymap[SCANCODE_ESCAPE] = SDLK_ESCAPE; |
131 keymap[SCANCODE_1] = SDLK_1; | 139 keymap[SCANCODE_1] = SDLK_1; |
132 keymap[SCANCODE_2] = SDLK_2; | 140 keymap[SCANCODE_2] = SDLK_2; |
133 keymap[SCANCODE_3] = SDLK_3; | 141 keymap[SCANCODE_3] = SDLK_3; |
134 keymap[SCANCODE_4] = SDLK_4; | 142 keymap[SCANCODE_4] = SDLK_4; |
135 keymap[SCANCODE_5] = SDLK_5; | 143 keymap[SCANCODE_5] = SDLK_5; |
136 keymap[SCANCODE_6] = SDLK_6; | 144 keymap[SCANCODE_6] = SDLK_6; |
137 keymap[SCANCODE_7] = SDLK_7; | 145 keymap[SCANCODE_7] = SDLK_7; |
138 keymap[SCANCODE_8] = SDLK_8; | 146 keymap[SCANCODE_8] = SDLK_8; |
139 keymap[SCANCODE_9] = SDLK_9; | 147 keymap[SCANCODE_9] = SDLK_9; |
140 keymap[SCANCODE_0] = SDLK_0; | 148 keymap[SCANCODE_0] = SDLK_0; |
141 keymap[SCANCODE_MINUS] = SDLK_MINUS; | 149 keymap[SCANCODE_MINUS] = SDLK_MINUS; |
142 keymap[SCANCODE_EQUAL] = SDLK_EQUALS; | 150 keymap[SCANCODE_EQUAL] = SDLK_EQUALS; |
143 keymap[SCANCODE_BACKSPACE] = SDLK_BACKSPACE; | 151 keymap[SCANCODE_BACKSPACE] = SDLK_BACKSPACE; |
144 keymap[SCANCODE_TAB] = SDLK_TAB; | 152 keymap[SCANCODE_TAB] = SDLK_TAB; |
145 keymap[SCANCODE_Q] = SDLK_q; | 153 keymap[SCANCODE_Q] = SDLK_q; |
146 keymap[SCANCODE_W] = SDLK_w; | 154 keymap[SCANCODE_W] = SDLK_w; |
147 keymap[SCANCODE_E] = SDLK_e; | 155 keymap[SCANCODE_E] = SDLK_e; |
148 keymap[SCANCODE_R] = SDLK_r; | 156 keymap[SCANCODE_R] = SDLK_r; |
149 keymap[SCANCODE_T] = SDLK_t; | 157 keymap[SCANCODE_T] = SDLK_t; |
150 keymap[SCANCODE_Y] = SDLK_y; | 158 keymap[SCANCODE_Y] = SDLK_y; |
151 keymap[SCANCODE_U] = SDLK_u; | 159 keymap[SCANCODE_U] = SDLK_u; |
152 keymap[SCANCODE_I] = SDLK_i; | 160 keymap[SCANCODE_I] = SDLK_i; |
153 keymap[SCANCODE_O] = SDLK_o; | 161 keymap[SCANCODE_O] = SDLK_o; |
154 keymap[SCANCODE_P] = SDLK_p; | 162 keymap[SCANCODE_P] = SDLK_p; |
155 keymap[SCANCODE_BRACKET_LEFT] = SDLK_LEFTBRACKET; | 163 keymap[SCANCODE_BRACKET_LEFT] = SDLK_LEFTBRACKET; |
156 keymap[SCANCODE_BRACKET_RIGHT] = SDLK_RIGHTBRACKET; | 164 keymap[SCANCODE_BRACKET_RIGHT] = SDLK_RIGHTBRACKET; |
157 keymap[SCANCODE_ENTER] = SDLK_RETURN; | 165 keymap[SCANCODE_ENTER] = SDLK_RETURN; |
158 keymap[SCANCODE_LEFTCONTROL] = SDLK_LCTRL; | 166 keymap[SCANCODE_LEFTCONTROL] = SDLK_LCTRL; |
159 keymap[SCANCODE_A] = SDLK_a; | 167 keymap[SCANCODE_A] = SDLK_a; |
160 keymap[SCANCODE_S] = SDLK_s; | 168 keymap[SCANCODE_S] = SDLK_s; |
161 keymap[SCANCODE_D] = SDLK_d; | 169 keymap[SCANCODE_D] = SDLK_d; |
162 keymap[SCANCODE_F] = SDLK_f; | 170 keymap[SCANCODE_F] = SDLK_f; |
163 keymap[SCANCODE_G] = SDLK_g; | 171 keymap[SCANCODE_G] = SDLK_g; |
164 keymap[SCANCODE_H] = SDLK_h; | 172 keymap[SCANCODE_H] = SDLK_h; |
165 keymap[SCANCODE_J] = SDLK_j; | 173 keymap[SCANCODE_J] = SDLK_j; |
166 keymap[SCANCODE_K] = SDLK_k; | 174 keymap[SCANCODE_K] = SDLK_k; |
167 keymap[SCANCODE_L] = SDLK_l; | 175 keymap[SCANCODE_L] = SDLK_l; |
168 keymap[SCANCODE_SEMICOLON] = SDLK_SEMICOLON; | 176 keymap[SCANCODE_SEMICOLON] = SDLK_SEMICOLON; |
169 keymap[SCANCODE_APOSTROPHE] = SDLK_QUOTE; | 177 keymap[SCANCODE_APOSTROPHE] = SDLK_QUOTE; |
170 keymap[SCANCODE_GRAVE] = SDLK_BACKQUOTE; | 178 keymap[SCANCODE_GRAVE] = SDLK_BACKQUOTE; |
171 keymap[SCANCODE_LEFTSHIFT] = SDLK_LSHIFT; | 179 keymap[SCANCODE_LEFTSHIFT] = SDLK_LSHIFT; |
172 keymap[SCANCODE_BACKSLASH] = SDLK_BACKSLASH; | 180 keymap[SCANCODE_BACKSLASH] = SDLK_BACKSLASH; |
173 keymap[SCANCODE_Z] = SDLK_z; | 181 keymap[SCANCODE_Z] = SDLK_z; |
174 keymap[SCANCODE_X] = SDLK_x; | 182 keymap[SCANCODE_X] = SDLK_x; |
175 keymap[SCANCODE_C] = SDLK_c; | 183 keymap[SCANCODE_C] = SDLK_c; |
176 keymap[SCANCODE_V] = SDLK_v; | 184 keymap[SCANCODE_V] = SDLK_v; |
177 keymap[SCANCODE_B] = SDLK_b; | 185 keymap[SCANCODE_B] = SDLK_b; |
178 keymap[SCANCODE_N] = SDLK_n; | 186 keymap[SCANCODE_N] = SDLK_n; |
179 keymap[SCANCODE_M] = SDLK_m; | 187 keymap[SCANCODE_M] = SDLK_m; |
180 keymap[SCANCODE_COMMA] = SDLK_COMMA; | 188 keymap[SCANCODE_COMMA] = SDLK_COMMA; |
181 keymap[SCANCODE_PERIOD] = SDLK_PERIOD; | 189 keymap[SCANCODE_PERIOD] = SDLK_PERIOD; |
182 keymap[SCANCODE_SLASH] = SDLK_SLASH; | 190 keymap[SCANCODE_SLASH] = SDLK_SLASH; |
183 keymap[SCANCODE_RIGHTSHIFT] = SDLK_RSHIFT; | 191 keymap[SCANCODE_RIGHTSHIFT] = SDLK_RSHIFT; |
184 keymap[SCANCODE_KEYPADMULTIPLY] = SDLK_KP_MULTIPLY; | 192 keymap[SCANCODE_KEYPADMULTIPLY] = SDLK_KP_MULTIPLY; |
185 keymap[SCANCODE_LEFTALT] = SDLK_LALT; | 193 keymap[SCANCODE_LEFTALT] = SDLK_LALT; |
186 keymap[SCANCODE_SPACE] = SDLK_SPACE; | 194 keymap[SCANCODE_SPACE] = SDLK_SPACE; |
187 keymap[SCANCODE_CAPSLOCK] = SDLK_CAPSLOCK; | 195 keymap[SCANCODE_CAPSLOCK] = SDLK_CAPSLOCK; |
188 keymap[SCANCODE_F1] = SDLK_F1; | 196 keymap[SCANCODE_F1] = SDLK_F1; |
189 keymap[SCANCODE_F2] = SDLK_F2; | 197 keymap[SCANCODE_F2] = SDLK_F2; |
190 keymap[SCANCODE_F3] = SDLK_F3; | 198 keymap[SCANCODE_F3] = SDLK_F3; |
191 keymap[SCANCODE_F4] = SDLK_F4; | 199 keymap[SCANCODE_F4] = SDLK_F4; |
192 keymap[SCANCODE_F5] = SDLK_F5; | 200 keymap[SCANCODE_F5] = SDLK_F5; |
193 keymap[SCANCODE_F6] = SDLK_F6; | 201 keymap[SCANCODE_F6] = SDLK_F6; |
194 keymap[SCANCODE_F7] = SDLK_F7; | 202 keymap[SCANCODE_F7] = SDLK_F7; |
195 keymap[SCANCODE_F8] = SDLK_F8; | 203 keymap[SCANCODE_F8] = SDLK_F8; |
196 keymap[SCANCODE_F9] = SDLK_F9; | 204 keymap[SCANCODE_F9] = SDLK_F9; |
197 keymap[SCANCODE_F10] = SDLK_F10; | 205 keymap[SCANCODE_F10] = SDLK_F10; |
198 keymap[SCANCODE_NUMLOCK] = SDLK_NUMLOCK; | 206 keymap[SCANCODE_NUMLOCK] = SDLK_NUMLOCK; |
199 keymap[SCANCODE_SCROLLLOCK] = SDLK_SCROLLOCK; | 207 keymap[SCANCODE_SCROLLLOCK] = SDLK_SCROLLOCK; |
200 keymap[SCANCODE_KEYPAD7] = SDLK_KP7; | 208 keymap[SCANCODE_KEYPAD7] = SDLK_KP7; |
201 keymap[SCANCODE_CURSORUPLEFT] = SDLK_KP7; | 209 keymap[SCANCODE_CURSORUPLEFT] = SDLK_KP7; |
202 keymap[SCANCODE_KEYPAD8] = SDLK_KP8; | 210 keymap[SCANCODE_KEYPAD8] = SDLK_KP8; |
203 keymap[SCANCODE_CURSORUP] = SDLK_KP8; | 211 keymap[SCANCODE_CURSORUP] = SDLK_KP8; |
204 keymap[SCANCODE_KEYPAD9] = SDLK_KP9; | 212 keymap[SCANCODE_KEYPAD9] = SDLK_KP9; |
205 keymap[SCANCODE_CURSORUPRIGHT] = SDLK_KP9; | 213 keymap[SCANCODE_CURSORUPRIGHT] = SDLK_KP9; |
206 keymap[SCANCODE_KEYPADMINUS] = SDLK_KP_MINUS; | 214 keymap[SCANCODE_KEYPADMINUS] = SDLK_KP_MINUS; |
207 keymap[SCANCODE_KEYPAD4] = SDLK_KP4; | 215 keymap[SCANCODE_KEYPAD4] = SDLK_KP4; |
208 keymap[SCANCODE_CURSORLEFT] = SDLK_KP4; | 216 keymap[SCANCODE_CURSORLEFT] = SDLK_KP4; |
209 keymap[SCANCODE_KEYPAD5] = SDLK_KP5; | 217 keymap[SCANCODE_KEYPAD5] = SDLK_KP5; |
210 keymap[SCANCODE_KEYPAD6] = SDLK_KP6; | 218 keymap[SCANCODE_KEYPAD6] = SDLK_KP6; |
211 keymap[SCANCODE_CURSORRIGHT] = SDLK_KP6; | 219 keymap[SCANCODE_CURSORRIGHT] = SDLK_KP6; |
212 keymap[SCANCODE_KEYPADPLUS] = SDLK_KP_PLUS; | 220 keymap[SCANCODE_KEYPADPLUS] = SDLK_KP_PLUS; |
213 keymap[SCANCODE_KEYPAD1] = SDLK_KP1; | 221 keymap[SCANCODE_KEYPAD1] = SDLK_KP1; |
214 keymap[SCANCODE_CURSORDOWNLEFT] = SDLK_KP1; | 222 keymap[SCANCODE_CURSORDOWNLEFT] = SDLK_KP1; |
215 keymap[SCANCODE_KEYPAD2] = SDLK_KP2; | 223 keymap[SCANCODE_KEYPAD2] = SDLK_KP2; |
216 keymap[SCANCODE_CURSORDOWN] = SDLK_KP2; | 224 keymap[SCANCODE_CURSORDOWN] = SDLK_KP2; |
217 keymap[SCANCODE_KEYPAD3] = SDLK_KP3; | 225 keymap[SCANCODE_KEYPAD3] = SDLK_KP3; |
218 keymap[SCANCODE_CURSORDOWNRIGHT] = SDLK_KP3; | 226 keymap[SCANCODE_CURSORDOWNRIGHT] = SDLK_KP3; |
219 keymap[SCANCODE_KEYPAD0] = SDLK_KP0; | 227 keymap[SCANCODE_KEYPAD0] = SDLK_KP0; |
220 keymap[SCANCODE_KEYPADPERIOD] = SDLK_KP_PERIOD; | 228 keymap[SCANCODE_KEYPADPERIOD] = SDLK_KP_PERIOD; |
221 keymap[SCANCODE_LESS] = SDLK_LESS; | 229 keymap[SCANCODE_LESS] = SDLK_LESS; |
222 keymap[SCANCODE_F11] = SDLK_F11; | 230 keymap[SCANCODE_F11] = SDLK_F11; |
223 keymap[SCANCODE_F12] = SDLK_F12; | 231 keymap[SCANCODE_F12] = SDLK_F12; |
224 keymap[SCANCODE_KEYPADENTER] = SDLK_KP_ENTER; | 232 keymap[SCANCODE_KEYPADENTER] = SDLK_KP_ENTER; |
225 keymap[SCANCODE_RIGHTCONTROL] = SDLK_RCTRL; | 233 keymap[SCANCODE_RIGHTCONTROL] = SDLK_RCTRL; |
226 keymap[SCANCODE_CONTROL] = SDLK_RCTRL; | 234 keymap[SCANCODE_CONTROL] = SDLK_RCTRL; |
227 keymap[SCANCODE_KEYPADDIVIDE] = SDLK_KP_DIVIDE; | 235 keymap[SCANCODE_KEYPADDIVIDE] = SDLK_KP_DIVIDE; |
228 keymap[SCANCODE_PRINTSCREEN] = SDLK_PRINT; | 236 keymap[SCANCODE_PRINTSCREEN] = SDLK_PRINT; |
229 keymap[SCANCODE_RIGHTALT] = SDLK_RALT; | 237 keymap[SCANCODE_RIGHTALT] = SDLK_RALT; |
230 keymap[SCANCODE_BREAK] = SDLK_BREAK; | 238 keymap[SCANCODE_BREAK] = SDLK_BREAK; |
231 keymap[SCANCODE_BREAK_ALTERNATIVE] = SDLK_UNKNOWN; | 239 keymap[SCANCODE_BREAK_ALTERNATIVE] = SDLK_UNKNOWN; |
232 keymap[SCANCODE_HOME] = SDLK_HOME; | 240 keymap[SCANCODE_HOME] = SDLK_HOME; |
233 keymap[SCANCODE_CURSORBLOCKUP] = SDLK_UP; | 241 keymap[SCANCODE_CURSORBLOCKUP] = SDLK_UP; |
234 keymap[SCANCODE_PAGEUP] = SDLK_PAGEUP; | 242 keymap[SCANCODE_PAGEUP] = SDLK_PAGEUP; |
235 keymap[SCANCODE_CURSORBLOCKLEFT] = SDLK_LEFT; | 243 keymap[SCANCODE_CURSORBLOCKLEFT] = SDLK_LEFT; |
236 keymap[SCANCODE_CURSORBLOCKRIGHT] = SDLK_RIGHT; | 244 keymap[SCANCODE_CURSORBLOCKRIGHT] = SDLK_RIGHT; |
237 keymap[SCANCODE_END] = SDLK_END; | 245 keymap[SCANCODE_END] = SDLK_END; |
238 keymap[SCANCODE_CURSORBLOCKDOWN] = SDLK_DOWN; | 246 keymap[SCANCODE_CURSORBLOCKDOWN] = SDLK_DOWN; |
239 keymap[SCANCODE_PAGEDOWN] = SDLK_PAGEDOWN; | 247 keymap[SCANCODE_PAGEDOWN] = SDLK_PAGEDOWN; |
240 keymap[SCANCODE_INSERT] = SDLK_INSERT; | 248 keymap[SCANCODE_INSERT] = SDLK_INSERT; |
241 keymap[SCANCODE_REMOVE] = SDLK_DELETE; | 249 keymap[SCANCODE_REMOVE] = SDLK_DELETE; |
242 keymap[119] = SDLK_PAUSE; | 250 keymap[119] = SDLK_PAUSE; |
243 keymap[SCANCODE_RIGHTWIN] = SDLK_RSUPER; | 251 keymap[SCANCODE_RIGHTWIN] = SDLK_RSUPER; |
244 keymap[SCANCODE_LEFTWIN] = SDLK_LSUPER; | 252 keymap[SCANCODE_LEFTWIN] = SDLK_LSUPER; |
245 keymap[127] = SDLK_MENU; | 253 keymap[127] = SDLK_MENU; |
246 } | 254 } |
247 | 255 |
248 | 256 |
249 | 257 |
250 static SDL_keysym *GGI_TranslateKey(gii_event *ev, SDL_keysym *keysym) | 258 static SDL_keysym * |
259 GGI_TranslateKey (gii_event * ev, SDL_keysym * keysym) | |
251 { | 260 { |
252 /* Set the keysym information */ | 261 /* Set the keysym information */ |
253 keysym->scancode = ev->key.button; | 262 keysym->scancode = ev->key.button; |
254 keysym->sym = keymap[ev->key.button]; | 263 keysym->sym = keymap[ev->key.button]; |
255 keysym->mod = KMOD_NONE; | 264 keysym->mod = KMOD_NONE; |
256 | 265 |
257 /* If UNICODE is on, get the UNICODE value for the key */ | 266 /* If UNICODE is on, get the UNICODE value for the key */ |
258 keysym->unicode = 0; | 267 keysym->unicode = 0; |
259 if (SDL_TranslateUNICODE) | 268 if (SDL_TranslateUNICODE) { |
260 { | 269 keysym->unicode = GII_UNICODE (ev->key.sym); |
261 keysym->unicode = GII_UNICODE(ev->key.sym); | 270 } |
262 } | 271 |
263 | 272 return keysym; |
264 return keysym; | |
265 } | 273 } |
274 | |
275 /* vi: set ts=4 sw=4 expandtab: */ |