comparison src/video/win32/SDL_win32events.c @ 4565:e2d46c5c7483

Fixed key repeat detection on X11, and simplified the code for everyone else.
author Sam Lantinga <slouken@libsdl.org>
date Wed, 21 Jul 2010 21:47:12 -0700
parents e4b2b7207f79
children e1664f94f026
comparison
equal deleted inserted replaced
4563:ffd169948438 4565:e2d46c5c7483
203 break; 203 break;
204 204
205 case WM_SYSKEYDOWN: 205 case WM_SYSKEYDOWN:
206 case WM_KEYDOWN: 206 case WM_KEYDOWN:
207 { 207 {
208 SDL_bool repeat;
209
210 if (lParam & REPEATED_KEYMASK) {
211 repeat = SDL_TRUE;
212 } else {
213 repeat = SDL_FALSE;
214 }
215
216 wParam = RemapVKEY(wParam, lParam); 208 wParam = RemapVKEY(wParam, lParam);
217 switch (wParam) { 209 switch (wParam) {
218 case VK_CONTROL: 210 case VK_CONTROL:
219 if (lParam & EXTENDED_KEYMASK) 211 if (lParam & EXTENDED_KEYMASK)
220 wParam = VK_RCONTROL; 212 wParam = VK_RCONTROL;
248 wParam = VK_ENTER; 240 wParam = VK_ENTER;
249 break; 241 break;
250 } 242 }
251 if (wParam < 256) { 243 if (wParam < 256) {
252 SDL_SendKeyboardKey(SDL_PRESSED, 244 SDL_SendKeyboardKey(SDL_PRESSED,
253 data->videodata->key_layout[wParam], 245 data->videodata->key_layout[wParam]);
254 repeat);
255 } 246 }
256 } 247 }
257 returnCode = 0; 248 returnCode = 0;
258 break; 249 break;
259 250
299 /* Windows only reports keyup for print screen */ 290 /* Windows only reports keyup for print screen */
300 if (wParam == VK_SNAPSHOT 291 if (wParam == VK_SNAPSHOT
301 && SDL_GetKeyboardState(NULL)[SDL_SCANCODE_PRINTSCREEN] == 292 && SDL_GetKeyboardState(NULL)[SDL_SCANCODE_PRINTSCREEN] ==
302 SDL_RELEASED) { 293 SDL_RELEASED) {
303 SDL_SendKeyboardKey(SDL_PRESSED, 294 SDL_SendKeyboardKey(SDL_PRESSED,
304 data->videodata->key_layout[wParam], 295 data->videodata->key_layout[wParam]);
305 SDL_FALSE);
306 } 296 }
307 if (wParam < 256) { 297 if (wParam < 256) {
308 SDL_SendKeyboardKey(SDL_RELEASED, 298 SDL_SendKeyboardKey(SDL_RELEASED,
309 data->videodata->key_layout[wParam], 299 data->videodata->key_layout[wParam]);
310 SDL_FALSE);
311 } 300 }
312 } 301 }
313 returnCode = 0; 302 returnCode = 0;
314 break; 303 break;
315 304