changeset 14:c3e9d4a623c1

Fixed stuck keys when changing the video mode
author Sam Lantinga <slouken@lokigames.com>
date Tue, 01 May 2001 21:12:57 +0000
parents e30a8ce27c22
children ac67f6758d63
files docs.html src/events/SDL_keyboard.c src/video/SDL_video.c src/video/x11/SDL_x11events.c
diffstat 4 files changed, 18 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/docs.html	Sun Apr 29 23:00:03 2001 +0000
+++ b/docs.html	Tue May 01 21:12:57 2001 +0000
@@ -16,6 +16,7 @@
 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!)
--- a/src/events/SDL_keyboard.c	Sun Apr 29 23:00:03 2001 +0000
+++ b/src/events/SDL_keyboard.c	Tue May 01 21:12:57 2001 +0000
@@ -335,6 +335,7 @@
 			SDL_PrivateKeyboard(SDL_RELEASED, &keysym);
 		}
 	}
+	SDL_KeyRepeat.timestamp = 0;
 }
 
 int SDL_EnableUNICODE(int enable)
--- a/src/video/SDL_video.c	Sun Apr 29 23:00:03 2001 +0000
+++ b/src/video/SDL_video.c	Tue May 01 21:12:57 2001 +0000
@@ -567,6 +567,9 @@
 		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;
--- a/src/video/x11/SDL_x11events.c	Sun Apr 29 23:00:03 2001 +0000
+++ b/src/video/x11/SDL_x11events.c	Tue May 01 21:12:57 2001 +0000
@@ -54,6 +54,9 @@
 #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 @@
 
 	    /* 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 @@
 	    /* 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 @@
 	    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,