Commit ea1961a5 authored by Sam Lantinga's avatar Sam Lantinga

Fixed stuck keys when changing the video mode

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%4015
parent 0329e5fd
...@@ -16,6 +16,7 @@ be found at the <A HREF="http://www.libsdl.org/"> main SDL page</A>. ...@@ -16,6 +16,7 @@ be found at the <A HREF="http://www.libsdl.org/"> main SDL page</A>.
Major changes since SDL 1.0.0: Major changes since SDL 1.0.0:
</H2> </H2>
<UL> <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 double-mouse event bug on Windows using OpenGL
<LI> 1.2.1: Fixed 320x200 video mode on framebuffer console <LI> 1.2.1: Fixed 320x200 video mode on framebuffer console
<LI> 1.2.1: Improved robustness for the ELO touchpad (thanks Alex!) <LI> 1.2.1: Improved robustness for the ELO touchpad (thanks Alex!)
......
...@@ -335,6 +335,7 @@ void SDL_ResetKeyboard(void) ...@@ -335,6 +335,7 @@ void SDL_ResetKeyboard(void)
SDL_PrivateKeyboard(SDL_RELEASED, &keysym); SDL_PrivateKeyboard(SDL_RELEASED, &keysym);
} }
} }
SDL_KeyRepeat.timestamp = 0;
} }
int SDL_EnableUNICODE(int enable) int SDL_EnableUNICODE(int enable)
......
...@@ -567,6 +567,9 @@ SDL_Surface * SDL_SetVideoMode (int width, int height, int bpp, Uint32 flags) ...@@ -567,6 +567,9 @@ SDL_Surface * SDL_SetVideoMode (int width, int height, int bpp, Uint32 flags)
flags &= ~(SDL_HWSURFACE|SDL_DOUBLEBUF); flags &= ~(SDL_HWSURFACE|SDL_DOUBLEBUF);
} }
/* Reset the keyboard here so event callbacks can run */
SDL_ResetKeyboard();
/* Clean up any previous video mode */ /* Clean up any previous video mode */
if ( SDL_PublicSurface != NULL ) { if ( SDL_PublicSurface != NULL ) {
SDL_PublicSurface = NULL; SDL_PublicSurface = NULL;
......
...@@ -54,6 +54,9 @@ static char rcsid = ...@@ -54,6 +54,9 @@ static char rcsid =
#include "SDL_x11events_c.h" #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 */ /* The translation tables from an X11 keysym to a SDL keysym */
static SDLKey ODD_keymap[256]; static SDLKey ODD_keymap[256];
static SDLKey MISC_keymap[256]; static SDLKey MISC_keymap[256];
...@@ -219,6 +222,9 @@ printf("FocusOut!\n"); ...@@ -219,6 +222,9 @@ printf("FocusOut!\n");
/* Generated upon EnterWindow and FocusIn */ /* Generated upon EnterWindow and FocusIn */
case KeymapNotify: { case KeymapNotify: {
#ifdef DEBUG_XEVENTS
printf("KeymapNotify!\n");
#endif
X11_SetKeyboardState(SDL_Display, xevent.xkeymap.key_vector); X11_SetKeyboardState(SDL_Display, xevent.xkeymap.key_vector);
} }
break; break;
...@@ -263,6 +269,10 @@ printf("FocusOut!\n"); ...@@ -263,6 +269,10 @@ printf("FocusOut!\n");
/* Key press? */ /* Key press? */
case KeyPress: { case KeyPress: {
SDL_keysym keysym; SDL_keysym keysym;
#ifdef DEBUG_XEVENTS
printf("KeyPress (X11 keycode = 0x%X)\n", xevent.xkey.keycode);
#endif
posted = SDL_PrivateKeyboard(SDL_PRESSED, posted = SDL_PrivateKeyboard(SDL_PRESSED,
X11_TranslateKey(SDL_Display, &xevent.xkey, X11_TranslateKey(SDL_Display, &xevent.xkey,
xevent.xkey.keycode, xevent.xkey.keycode,
...@@ -274,6 +284,9 @@ printf("FocusOut!\n"); ...@@ -274,6 +284,9 @@ printf("FocusOut!\n");
case KeyRelease: { case KeyRelease: {
SDL_keysym keysym; 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 */ /* Check to see if this is a repeated key */
if ( ! X11_KeyRepeat(SDL_Display, &xevent) ) { if ( ! X11_KeyRepeat(SDL_Display, &xevent) ) {
posted = SDL_PrivateKeyboard(SDL_RELEASED, posted = SDL_PrivateKeyboard(SDL_RELEASED,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment