changeset 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 0a98dba2c700
children e7f75aaf542f
files src/events/SDL_keyboard.c
diffstat 1 files changed, 11 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/events/SDL_keyboard.c	Fri Nov 02 19:16:53 2001 +0000
+++ b/src/events/SDL_keyboard.c	Fri Nov 02 19:49:14 2001 +0000
@@ -514,16 +514,16 @@
 	if ( SDL_ProcessEvents[event.type] == SDL_ENABLE ) {
 		event.key.state = state;
 		event.key.keysym = *keysym;
+		/*
+		 * jk 991215 - Added
+		 */
+		if (repeatable && (SDL_KeyRepeat.delay != 0)) {
+			SDL_KeyRepeat.evt = event;
+			SDL_KeyRepeat.firsttime = 1;
+			SDL_KeyRepeat.timestamp=SDL_GetTicks();
+		}
 		if ( (SDL_EventOK == NULL) || SDL_EventOK(&event) ) {
 			posted = 1;
-			/*
-			 * jk 991215 - Added
-			 */
-			if (repeatable && (SDL_KeyRepeat.delay != 0)) {
-				SDL_KeyRepeat.evt = event;
-				SDL_KeyRepeat.firsttime = 1;
-				SDL_KeyRepeat.timestamp=SDL_GetTicks();
-			}
 			SDL_PushEvent(&event);
 		}
 	}
@@ -548,7 +548,9 @@
 		} else {
 			if ( interval > (Uint32)SDL_KeyRepeat.interval ) {
 				SDL_KeyRepeat.timestamp = now;
-				SDL_PushEvent(&SDL_KeyRepeat.evt);
+				if ( (SDL_EventOK == NULL) || SDL_EventOK(&SDL_KeyRepeat.evt) ) {
+					SDL_PushEvent(&SDL_KeyRepeat.evt);
+				}
 			}
 		}
 	}