Skip to content
Permalink
Browse files

Fixed stuck keys when changing the video mode

  • Loading branch information
Sam Lantinga committed May 1, 2001
1 parent 8b4194d commit 8e0efc580dda8a0d01df1b51506193d1360cf70f
Showing with 18 additions and 0 deletions.
  1. +1 −0 docs.html
  2. +1 −0 src/events/SDL_keyboard.c
  3. +3 −0 src/video/SDL_video.c
  4. +13 −0 src/video/x11/SDL_x11events.c
@@ -16,6 +16,7 @@ <H2>
Major changes since SDL 1.0.0:
</H2>
<UL>
<LI> 1.2.1: Fixed stuck keys when changing the video mode
<LI> 1.2.1: Fixed double-mouse event bug on Windows using OpenGL
<LI> 1.2.1: Fixed 320x200 video mode on framebuffer console
<LI> 1.2.1: Improved robustness for the ELO touchpad (thanks Alex!)
@@ -335,6 +335,7 @@ void SDL_ResetKeyboard(void)
SDL_PrivateKeyboard(SDL_RELEASED, &keysym);
}
}
SDL_KeyRepeat.timestamp = 0;
}

int SDL_EnableUNICODE(int enable)
@@ -567,6 +567,9 @@ SDL_Surface * SDL_SetVideoMode (int width, int height, int bpp, Uint32 flags)
flags &= ~(SDL_HWSURFACE|SDL_DOUBLEBUF);
}

/* Reset the keyboard here so event callbacks can run */
SDL_ResetKeyboard();

/* Clean up any previous video mode */
if ( SDL_PublicSurface != NULL ) {
SDL_PublicSurface = NULL;
@@ -54,6 +54,9 @@ static char rcsid =
#include "SDL_x11events_c.h"


/* Define this if you want to debug X11 events */
/*#define DEBUG_XEVENTS*/

/* The translation tables from an X11 keysym to a SDL keysym */
static SDLKey ODD_keymap[256];
static SDLKey MISC_keymap[256];
@@ -219,6 +222,9 @@ printf("FocusOut!\n");

/* Generated upon EnterWindow and FocusIn */
case KeymapNotify: {
#ifdef DEBUG_XEVENTS
printf("KeymapNotify!\n");
#endif
X11_SetKeyboardState(SDL_Display, xevent.xkeymap.key_vector);
}
break;
@@ -263,6 +269,10 @@ printf("FocusOut!\n");
/* Key press? */
case KeyPress: {
SDL_keysym keysym;

#ifdef DEBUG_XEVENTS
printf("KeyPress (X11 keycode = 0x%X)\n", xevent.xkey.keycode);
#endif
posted = SDL_PrivateKeyboard(SDL_PRESSED,
X11_TranslateKey(SDL_Display, &xevent.xkey,
xevent.xkey.keycode,
@@ -274,6 +284,9 @@ printf("FocusOut!\n");
case KeyRelease: {
SDL_keysym keysym;

#ifdef DEBUG_XEVENTS
printf("KeyRelease (X11 keycode = 0x%X)\n", xevent.xkey.keycode);
#endif
/* Check to see if this is a repeated key */
if ( ! X11_KeyRepeat(SDL_Display, &xevent) ) {
posted = SDL_PrivateKeyboard(SDL_RELEASED,

0 comments on commit 8e0efc5

Please sign in to comment.