diff src/events/SDL_mouse.c @ 460:a888b3ae31ff

Reset mouse state when changing video modes
author Sam Lantinga <slouken@libsdl.org>
date Tue, 20 Aug 2002 06:01:20 +0000
parents f6ffac90895c
children 300b46757b7a
line wrap: on
line diff
--- a/src/events/SDL_mouse.c	Tue Aug 20 05:59:31 2002 +0000
+++ b/src/events/SDL_mouse.c	Tue Aug 20 06:01:20 2002 +0000
@@ -59,6 +59,17 @@
 	return(0);
 }
 
+/* We lost the mouse, so post button up messages for all pressed buttons */
+void SDL_ResetMouse(void)
+{
+	int i;
+	for ( i = 0; i < sizeof(SDL_ButtonState)*8; ++i ) {
+		if ( SDL_ButtonState & SDL_BUTTON(i) ) {
+			SDL_PrivateMouseButton(SDL_RELEASED, i, 0, 0);
+		}
+	}
+}
+
 Uint8 SDL_GetMouseState (int *x, int *y)
 {
 	if ( x )