Skip to content
Permalink
Browse files

Fix uninitialized variable warning

  • Loading branch information
slouken committed Jun 13, 2002
1 parent 5d8d5e3 commit 3fbf1823423c0a54d3f74b1e277577b53b397f22
Showing with 3 additions and 26 deletions.
  1. +3 −26 src/video/x11/SDL_x11events.c
@@ -835,7 +835,7 @@ Uint16 X11_KeyToUnicode(SDLKey keysym, SDLMod modifiers)
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 @@ void X11_SetKeyboardState(Display *display, const char *key_vec)

/* The first time the window is mapped, we initialize key state */
if ( ! key_vec ) {
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
key_vec = keys_return;
}

/* Get the keyboard modifier state */
@@ -927,23 +920,7 @@ void X11_SetKeyboardState(Display *display, const char *key_vec)
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;
}
}

0 comments on commit 3fbf182

Please sign in to comment.