src/events/SDL_keyboard.c
changeset 6661 cd8befc0a969
parent 6138 4c64952a58fb
child 6665 c0ea8c57034c
     1.1 --- a/src/events/SDL_keyboard.c	Wed Nov 07 08:49:59 2012 -0800
     1.2 +++ b/src/events/SDL_keyboard.c	Wed Nov 07 11:13:28 2012 -0800
     1.3 @@ -28,6 +28,8 @@
     1.4  #include "../video/SDL_sysvideo.h"
     1.5  
     1.6  
     1.7 +/*#define DEBUG_KEYBOARD*/
     1.8 +
     1.9  /* Global keyboard information */
    1.10  
    1.11  typedef struct SDL_Keyboard SDL_Keyboard;
    1.12 @@ -563,6 +565,9 @@
    1.13      SDL_Keyboard *keyboard = &SDL_keyboard;
    1.14      SDL_Scancode scancode;
    1.15  
    1.16 +#ifdef DEBUG_KEYBOARD
    1.17 +    printf("Resetting keyboard\n");
    1.18 +#endif
    1.19      for (scancode = 0; scancode < SDL_NUM_SCANCODES; ++scancode) {
    1.20          if (keyboard->keystate[scancode] == SDL_PRESSED) {
    1.21              SDL_SendKeyboardKey(SDL_RELEASED, scancode);
    1.22 @@ -633,6 +638,9 @@
    1.23                  video->StartTextInput(video);
    1.24              }
    1.25          }
    1.26 +    } else {
    1.27 +        /* We won't get anymore keyboard messages, so reset keyboard state */
    1.28 +        SDL_ResetKeyboard();
    1.29      }
    1.30  }
    1.31  
    1.32 @@ -648,7 +656,7 @@
    1.33      if (!scancode) {
    1.34          return 0;
    1.35      }
    1.36 -#if 0
    1.37 +#ifdef DEBUG_KEYBOARD
    1.38      printf("The '%s' key has been %s\n", SDL_GetScancodeName(scancode),
    1.39             state == SDL_PRESSED ? "pressed" : "released");
    1.40  #endif