Mercurial > sdl-ios-xcode
comparison src/video/win32/SDL_win32events.c @ 4560:95352c671a6e
Added support for keyboard repeat (only tested on Windows so far)
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 20 Jul 2010 23:25:24 -0700 |
parents | 9faebccfefb3 |
children | e4b2b7207f79 |
comparison
equal
deleted
inserted
replaced
4559:f8c3870af5a2 | 4560:95352c671a6e |
---|---|
199 break; | 199 break; |
200 | 200 |
201 case WM_SYSKEYDOWN: | 201 case WM_SYSKEYDOWN: |
202 case WM_KEYDOWN: | 202 case WM_KEYDOWN: |
203 { | 203 { |
204 /* Ignore repeated keys */ | 204 SDL_bool repeat; |
205 | |
205 if (lParam & REPEATED_KEYMASK) { | 206 if (lParam & REPEATED_KEYMASK) { |
206 returnCode = 0; | 207 repeat = SDL_TRUE; |
207 break; | 208 } else { |
209 repeat = SDL_FALSE; | |
208 } | 210 } |
209 | 211 |
210 wParam = RemapVKEY(wParam, lParam); | 212 wParam = RemapVKEY(wParam, lParam); |
211 switch (wParam) { | 213 switch (wParam) { |
212 case VK_CONTROL: | 214 case VK_CONTROL: |
242 wParam = VK_ENTER; | 244 wParam = VK_ENTER; |
243 break; | 245 break; |
244 } | 246 } |
245 if (wParam < 256) { | 247 if (wParam < 256) { |
246 SDL_SendKeyboardKey(SDL_PRESSED, | 248 SDL_SendKeyboardKey(SDL_PRESSED, |
247 data->videodata->key_layout[wParam]); | 249 data->videodata->key_layout[wParam], |
250 repeat); | |
248 } | 251 } |
249 } | 252 } |
250 returnCode = 0; | 253 returnCode = 0; |
251 break; | 254 break; |
252 | 255 |
292 /* Windows only reports keyup for print screen */ | 295 /* Windows only reports keyup for print screen */ |
293 if (wParam == VK_SNAPSHOT | 296 if (wParam == VK_SNAPSHOT |
294 && SDL_GetKeyboardState(NULL)[SDL_SCANCODE_PRINTSCREEN] == | 297 && SDL_GetKeyboardState(NULL)[SDL_SCANCODE_PRINTSCREEN] == |
295 SDL_RELEASED) { | 298 SDL_RELEASED) { |
296 SDL_SendKeyboardKey(SDL_PRESSED, | 299 SDL_SendKeyboardKey(SDL_PRESSED, |
297 data->videodata->key_layout[wParam]); | 300 data->videodata->key_layout[wParam], |
301 SDL_FALSE); | |
298 } | 302 } |
299 if (wParam < 256) { | 303 if (wParam < 256) { |
300 SDL_SendKeyboardKey(SDL_RELEASED, | 304 SDL_SendKeyboardKey(SDL_RELEASED, |
301 data->videodata->key_layout[wParam]); | 305 data->videodata->key_layout[wParam], |
306 SDL_FALSE); | |
302 } | 307 } |
303 } | 308 } |
304 returnCode = 0; | 309 returnCode = 0; |
305 break; | 310 break; |
306 | 311 |