Fixed key repeat interactions with event filters (thanks Elmar!)
authorSam Lantinga <slouken@libsdl.org>
Fri, 02 Nov 2001 19:49:14 +0000
changeset 2238d370608ba0a
parent 222 0a98dba2c700
child 224 e7f75aaf542f
Fixed key repeat interactions with event filters (thanks Elmar!)
src/events/SDL_keyboard.c
     1.1 --- a/src/events/SDL_keyboard.c	Fri Nov 02 19:16:53 2001 +0000
     1.2 +++ b/src/events/SDL_keyboard.c	Fri Nov 02 19:49:14 2001 +0000
     1.3 @@ -514,16 +514,16 @@
     1.4  	if ( SDL_ProcessEvents[event.type] == SDL_ENABLE ) {
     1.5  		event.key.state = state;
     1.6  		event.key.keysym = *keysym;
     1.7 +		/*
     1.8 +		 * jk 991215 - Added
     1.9 +		 */
    1.10 +		if (repeatable && (SDL_KeyRepeat.delay != 0)) {
    1.11 +			SDL_KeyRepeat.evt = event;
    1.12 +			SDL_KeyRepeat.firsttime = 1;
    1.13 +			SDL_KeyRepeat.timestamp=SDL_GetTicks();
    1.14 +		}
    1.15  		if ( (SDL_EventOK == NULL) || SDL_EventOK(&event) ) {
    1.16  			posted = 1;
    1.17 -			/*
    1.18 -			 * jk 991215 - Added
    1.19 -			 */
    1.20 -			if (repeatable && (SDL_KeyRepeat.delay != 0)) {
    1.21 -				SDL_KeyRepeat.evt = event;
    1.22 -				SDL_KeyRepeat.firsttime = 1;
    1.23 -				SDL_KeyRepeat.timestamp=SDL_GetTicks();
    1.24 -			}
    1.25  			SDL_PushEvent(&event);
    1.26  		}
    1.27  	}
    1.28 @@ -548,7 +548,9 @@
    1.29  		} else {
    1.30  			if ( interval > (Uint32)SDL_KeyRepeat.interval ) {
    1.31  				SDL_KeyRepeat.timestamp = now;
    1.32 -				SDL_PushEvent(&SDL_KeyRepeat.evt);
    1.33 +				if ( (SDL_EventOK == NULL) || SDL_EventOK(&SDL_KeyRepeat.evt) ) {
    1.34 +					SDL_PushEvent(&SDL_KeyRepeat.evt);
    1.35 +				}
    1.36  			}
    1.37  		}
    1.38  	}