diff --git a/src/video/x11/SDL_x11video.c b/src/video/x11/SDL_x11video.c index e423ab8d5d1b830348d0e0b0600891d2909613a8..51d34cee2a7ce4e0e329de08231f601f6f469fc1 100644 --- a/src/video/x11/SDL_x11video.c +++ b/src/video/x11/SDL_x11video.c @@ -833,6 +833,30 @@ static int X11_CreateWindow(_THIS, SDL_Surface *screen, /* Update the internal keyboard state */ X11_SetKeyboardState(SDL_Display, NULL); + /* When the window is first mapped, ignore non-modifier keys */ + { + Uint8 *keys = SDL_GetKeyState(NULL); + for ( i = 0; i < SDLK_LAST; ++i ) { + switch (i) { + case SDLK_NUMLOCK: + case SDLK_CAPSLOCK: + case SDLK_LCTRL: + case SDLK_RCTRL: + case SDLK_LSHIFT: + case SDLK_RSHIFT: + case SDLK_LALT: + case SDLK_RALT: + case SDLK_LMETA: + case SDLK_RMETA: + case SDLK_MODE: + break; + default: + keys[i] = SDL_RELEASED; + break; + } + } + } + /* Map them both and go fullscreen, if requested */ if ( ! SDL_windowid ) { XMapWindow(SDL_Display, SDL_Window);