changeset 412:ac59b067815b

Fix uninitialized variable warning
author Sam Lantinga <slouken@libsdl.org>
date Thu, 13 Jun 2002 16:54:38 +0000
parents 8c4999b0ac10
children 2a1486305412
files src/video/x11/SDL_x11events.c
diffstat 1 files changed, 3 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/src/video/x11/SDL_x11events.c	Thu Jun 13 16:54:26 2002 +0000
+++ b/src/video/x11/SDL_x11events.c	Thu Jun 13 16:54:38 2002 +0000
@@ -835,7 +835,7 @@
 void X11_SetKeyboardState(Display *display, const char *key_vec)
 {
 	char keys_return[32];
-	int i, gen_event;
+	int i;
 	KeyCode xcode[SDLK_LAST];
 	Uint8 new_kstate[SDLK_LAST];
 	Uint8 *kstate = SDL_GetKeyState(NULL);
@@ -846,15 +846,8 @@
 
 	/* The first time the window is mapped, we initialize key state */
 	if ( ! key_vec ) {
+		XQueryKeymap(display, keys_return);
 		key_vec = keys_return;
-		XQueryKeymap(display, keys_return);
-		gen_event = 0;
-	} else {
-#if 1 /* We no longer generate key down events, just update state */
-		gen_event = 0;
-#else
-		gen_event = 1;
-#endif
 	}
 
 	/* Get the keyboard modifier state */
@@ -927,23 +920,7 @@
 					break;
 			}
 		}
-		if ( kstate[i] == state )
-			continue;
-
-		/*
-		 * Send a fake keyboard event correcting the difference between
-		 * SDL's keyboard state and the actual. Note that there is no
-		 * way to find out the scancode for key releases, but since all
-		 * keys are released when focus is lost only keypresses should
-		 * be sent here
-		 */
-		if ( gen_event ) {
-			SDL_keysym sk;
-			memset(&sk, 0, sizeof(sk));
-			sk.sym = i;
-			sk.scancode = xcode[i];	/* only valid for key press */
-			SDL_PrivateKeyboard(state, &sk);
-		} else {
+		if ( kstate[i] != state ) {
 			kstate[i] = state;
 		}
 	}