Skip to content

Commit

Permalink
Fix uninitialized variable warning
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Jun 13, 2002
1 parent 5d8d5e3 commit 3fbf182
Showing 1 changed file with 3 additions and 26 deletions.
29 changes: 3 additions & 26 deletions src/video/x11/SDL_x11events.c
Expand Up @@ -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);
Expand All @@ -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 */
Expand Down Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 3fbf182

Please sign in to comment.