diff src/events/SDL_keyboard.c @ 1327:d12a63a8d95a

Resolved bug #130 Use XFilterEvent() to handle dead-key composition under X11 Cleaned up the code in preparation for 1.3 API changes
author Sam Lantinga <slouken@libsdl.org>
date Sat, 04 Feb 2006 08:35:11 +0000
parents c9b51268668f
children 450721ad5436
line wrap: on
line diff
--- a/src/events/SDL_keyboard.c	Fri Feb 03 07:43:42 2006 +0000
+++ b/src/events/SDL_keyboard.c	Sat Feb 04 08:35:11 2006 +0000
@@ -397,6 +397,8 @@
 	if ( state == SDL_PRESSED ) {
 		keysym->mod = (SDLMod)modstate;
 		switch (keysym->sym) {
+			case SDLK_UNKNOWN:
+				break;
 			case SDLK_NUMLOCK:
 				modstate ^= KMOD_NUM;
 				if ( ! (modstate&KMOD_NUM) )
@@ -442,6 +444,8 @@
 		}
 	} else {
 		switch (keysym->sym) {
+			case SDLK_UNKNOWN:
+				break;
 			case SDLK_NUMLOCK:
 			case SDLK_CAPSLOCK:
 				/* Only send keydown events */
@@ -499,17 +503,19 @@
 			return(0);
 	}
 
-	/* Drop events that don't change state */
-	if ( SDL_KeyState[keysym->sym] == state ) {
+	if ( keysym->sym != SDLK_UNKNOWN ) {
+		/* Drop events that don't change state */
+		if ( SDL_KeyState[keysym->sym] == state ) {
 #if 0
 printf("Keyboard event didn't change state - dropped!\n");
 #endif
-		return(0);
-	}
+			return(0);
+		}
 
-	/* Update internal keyboard state */
-	SDL_ModState = (SDLMod)modstate;
-	SDL_KeyState[keysym->sym] = state;
+		/* Update internal keyboard state */
+		SDL_ModState = (SDLMod)modstate;
+		SDL_KeyState[keysym->sym] = state;
+	}
 
 	/* Post the event, if desired */
 	posted = 0;