# HG changeset patch # User Sam Lantinga # Date 1023987278 0 # Node ID ac59b067815b7a130085660dc3924b14c80e7d47 # Parent 8c4999b0ac105da2eeea4dcc7432f2968bd4b90c Fix uninitialized variable warning diff -r 8c4999b0ac10 -r ac59b067815b src/video/x11/SDL_x11events.c --- 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; } }