src/events/SDL_keyboard.c
changeset 4565 e2d46c5c7483
parent 4562 dc9d77a26388
child 4567 1d7ea8724f4a
     1.1 --- a/src/events/SDL_keyboard.c	Wed Jul 21 00:11:56 2010 -0700
     1.2 +++ b/src/events/SDL_keyboard.c	Wed Jul 21 21:47:12 2010 -0700
     1.3 @@ -566,7 +566,7 @@
     1.4  
     1.5      for (scancode = 0; scancode < SDL_NUM_SCANCODES; ++scancode) {
     1.6          if (keyboard->keystate[scancode] == SDL_PRESSED) {
     1.7 -            SDL_SendKeyboardKey(SDL_RELEASED, scancode, SDL_FALSE);
     1.8 +            SDL_SendKeyboardKey(SDL_RELEASED, scancode);
     1.9          }
    1.10      }
    1.11  }
    1.12 @@ -627,12 +627,13 @@
    1.13  }
    1.14  
    1.15  int
    1.16 -SDL_SendKeyboardKey(Uint8 state, SDL_scancode scancode, SDL_bool repeat)
    1.17 +SDL_SendKeyboardKey(Uint8 state, SDL_scancode scancode)
    1.18  {
    1.19      SDL_Keyboard *keyboard = &SDL_keyboard;
    1.20      int posted;
    1.21      Uint16 modstate;
    1.22      Uint32 type;
    1.23 +    Uint8 repeat;
    1.24  
    1.25      if (!scancode) {
    1.26          return 0;
    1.27 @@ -732,6 +733,7 @@
    1.28      }
    1.29  
    1.30      /* Drop events that don't change state */
    1.31 +    repeat = (state && keyboard->keystate[scancode]);
    1.32      if (keyboard->keystate[scancode] == state && !repeat) {
    1.33  #if 0
    1.34          printf("Keyboard event didn't change state - dropped!\n");
    1.35 @@ -748,7 +750,7 @@
    1.36          SDL_Event event;
    1.37          event.key.type = type;
    1.38          event.key.state = state;
    1.39 -        event.key.repeat = repeat ? 1 : 0;
    1.40 +        event.key.repeat = repeat;
    1.41          event.key.keysym.scancode = scancode;
    1.42          event.key.keysym.sym = keyboard->keymap[scancode];
    1.43          event.key.keysym.mod = modstate;