src/events/SDL_keyboard.c
changeset 4762 833a225613e2
parent 4729 1f7ad083fd3c
child 4763 518d1679d2d0
equal deleted inserted replaced
4729:1f7ad083fd3c 4762:833a225613e2
   727     case SDL_RELEASED:
   727     case SDL_RELEASED:
   728         type = SDL_KEYUP;
   728         type = SDL_KEYUP;
   729         break;
   729         break;
   730     default:
   730     default:
   731         /* Invalid state -- bail */
   731         /* Invalid state -- bail */
   732         return 2;
   732         return 0;
   733     }
   733     }
   734 
   734 
   735     /* Drop events that don't change state */
   735     /* Drop events that don't change state */
   736     repeat = (state && keyboard->keystate[scancode]);
   736     repeat = (state && keyboard->keystate[scancode]);
   737     if (keyboard->keystate[scancode] == state && !repeat) {
   737     if (keyboard->keystate[scancode] == state && !repeat) {
   738 #if 0
   738 #if 0
   739         printf("Keyboard event didn't change state - dropped!\n");
   739         printf("Keyboard event didn't change state - dropped!\n");
   740 #endif
   740 #endif
   741         return 3;
   741         return 0;
   742     }
   742     }
   743 
   743 
   744     /* Update internal keyboard state */
   744     /* Update internal keyboard state */
   745     keyboard->keystate[scancode] = state;
   745     keyboard->keystate[scancode] = state;
   746 
   746 
   747     /* Post the event, if desired */
   747     /* Post the event, if desired */
   748     posted = 4;
   748     posted = 0;
   749     if (SDL_GetEventState(type) == SDL_ENABLE) {
   749     if (SDL_GetEventState(type) == SDL_ENABLE) {
   750         SDL_Event event;
   750         SDL_Event event;
   751         event.key.type = type;
   751         event.key.type = type;
   752         event.key.state = state;
   752         event.key.state = state;
   753         event.key.repeat = repeat;
   753         event.key.repeat = repeat;