src/events/SDL_keyboard.c
changeset 4713 ba38983b10c2
parent 4437 25e45611fa3d
child 4729 1f7ad083fd3c
     1.1 --- a/src/events/SDL_keyboard.c	Tue Jun 29 01:30:11 2010 +1200
     1.2 +++ b/src/events/SDL_keyboard.c	Wed Jul 07 00:43:23 2010 +1200
     1.3 @@ -694,8 +694,16 @@
     1.4      Uint16 modstate;
     1.5      Uint32 type;
     1.6  
     1.7 +    if(!keyboard){
     1.8 +        return 7;
     1.9 +    }
    1.10 +
    1.11 +    if(!scancode){
    1.12 +        return 8;
    1.13 +    }
    1.14 +
    1.15      if (!keyboard || !scancode) {
    1.16 -        return 0;
    1.17 +        return 1;
    1.18      }
    1.19  #if 0
    1.20      printf("The '%s' key has been %s\n", SDL_GetScancodeName(scancode),
    1.21 @@ -788,7 +796,7 @@
    1.22          break;
    1.23      default:
    1.24          /* Invalid state -- bail */
    1.25 -        return 0;
    1.26 +        return 2;
    1.27      }
    1.28  
    1.29      /* Drop events that don't change state */
    1.30 @@ -796,14 +804,14 @@
    1.31  #if 0
    1.32          printf("Keyboard event didn't change state - dropped!\n");
    1.33  #endif
    1.34 -        return 0;
    1.35 +        return 3;
    1.36      }
    1.37  
    1.38      /* Update internal keyboard state */
    1.39      keyboard->keystate[scancode] = state;
    1.40  
    1.41      /* Post the event, if desired */
    1.42 -    posted = 0;
    1.43 +    posted = 4;
    1.44      if (SDL_GetEventState(type) == SDL_ENABLE) {
    1.45          SDL_Event event;
    1.46          event.key.type = type;