diff 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
line wrap: on
line diff
--- a/src/video/win32/SDL_win32events.c	Tue Jul 20 00:57:01 2010 -0700
+++ b/src/video/win32/SDL_win32events.c	Tue Jul 20 23:25:24 2010 -0700
@@ -201,10 +201,12 @@
     case WM_SYSKEYDOWN:
     case WM_KEYDOWN:
         {
-            /* Ignore repeated keys */
+            SDL_bool repeat;
+
             if (lParam & REPEATED_KEYMASK) {
-                returnCode = 0;
-                break;
+                repeat = SDL_TRUE;
+            } else {
+                repeat = SDL_FALSE;
             }
 
             wParam = RemapVKEY(wParam, lParam);
@@ -244,7 +246,8 @@
             }
             if (wParam < 256) {
                 SDL_SendKeyboardKey(SDL_PRESSED,
-                                    data->videodata->key_layout[wParam]);
+                                    data->videodata->key_layout[wParam],
+                                    repeat);
             }
         }
         returnCode = 0;
@@ -294,11 +297,13 @@
                 && SDL_GetKeyboardState(NULL)[SDL_SCANCODE_PRINTSCREEN] ==
                 SDL_RELEASED) {
                 SDL_SendKeyboardKey(SDL_PRESSED,
-                                    data->videodata->key_layout[wParam]);
+                                    data->videodata->key_layout[wParam],
+                                    SDL_FALSE);
             }
             if (wParam < 256) {
                 SDL_SendKeyboardKey(SDL_RELEASED,
-                                    data->videodata->key_layout[wParam]);
+                                    data->videodata->key_layout[wParam],
+                                    SDL_FALSE);
             }
         }
         returnCode = 0;