comparison src/events/SDL_keyboard.c @ 223:8d370608ba0a

Fixed key repeat interactions with event filters (thanks Elmar!)
author Sam Lantinga <slouken@libsdl.org>
date Fri, 02 Nov 2001 19:49:14 +0000
parents 3142d2ac11db
children e8157fcb3114
comparison
equal deleted inserted replaced
222:0a98dba2c700 223:8d370608ba0a
512 /* Post the event, if desired */ 512 /* Post the event, if desired */
513 posted = 0; 513 posted = 0;
514 if ( SDL_ProcessEvents[event.type] == SDL_ENABLE ) { 514 if ( SDL_ProcessEvents[event.type] == SDL_ENABLE ) {
515 event.key.state = state; 515 event.key.state = state;
516 event.key.keysym = *keysym; 516 event.key.keysym = *keysym;
517 /*
518 * jk 991215 - Added
519 */
520 if (repeatable && (SDL_KeyRepeat.delay != 0)) {
521 SDL_KeyRepeat.evt = event;
522 SDL_KeyRepeat.firsttime = 1;
523 SDL_KeyRepeat.timestamp=SDL_GetTicks();
524 }
517 if ( (SDL_EventOK == NULL) || SDL_EventOK(&event) ) { 525 if ( (SDL_EventOK == NULL) || SDL_EventOK(&event) ) {
518 posted = 1; 526 posted = 1;
519 /*
520 * jk 991215 - Added
521 */
522 if (repeatable && (SDL_KeyRepeat.delay != 0)) {
523 SDL_KeyRepeat.evt = event;
524 SDL_KeyRepeat.firsttime = 1;
525 SDL_KeyRepeat.timestamp=SDL_GetTicks();
526 }
527 SDL_PushEvent(&event); 527 SDL_PushEvent(&event);
528 } 528 }
529 } 529 }
530 return(posted); 530 return(posted);
531 } 531 }
546 SDL_KeyRepeat.firsttime = 0; 546 SDL_KeyRepeat.firsttime = 0;
547 } 547 }
548 } else { 548 } else {
549 if ( interval > (Uint32)SDL_KeyRepeat.interval ) { 549 if ( interval > (Uint32)SDL_KeyRepeat.interval ) {
550 SDL_KeyRepeat.timestamp = now; 550 SDL_KeyRepeat.timestamp = now;
551 SDL_PushEvent(&SDL_KeyRepeat.evt); 551 if ( (SDL_EventOK == NULL) || SDL_EventOK(&SDL_KeyRepeat.evt) ) {
552 SDL_PushEvent(&SDL_KeyRepeat.evt);
553 }
552 } 554 }
553 } 555 }
554 } 556 }
555 } 557 }
556 558