changeset 4169:27c0db0fbfad SDL-1.2

Fixed bug #611 Comment #22 From Tim Angus 2009-04-02 08:45:52 (-) [reply] ------- First of all, thanks for committing this. Unfortunately it seems the patch has only partially applied to wincommon/SDL_sysevents.c and currently a clean SDL 1.2 checkout doesn't build. The new patch here (http://bugzilla.libsdl.org/attachment.cgi?id=316) fixes this.
author Sam Lantinga <slouken@libsdl.org>
date Mon, 13 Apr 2009 08:38:04 +0000
parents 69bcba65c388
children 092c0bc69155
files src/video/wincommon/SDL_sysevents.c
diffstat 1 files changed, 15 insertions(+), 48 deletions(-) [+]
line wrap: on
line diff
--- a/src/video/wincommon/SDL_sysevents.c	Mon Apr 13 00:53:12 2009 +0000
+++ b/src/video/wincommon/SDL_sysevents.c	Mon Apr 13 08:38:04 2009 +0000
@@ -438,62 +438,41 @@
 		break;
 
 		case WM_MOUSEMOVE: {
-			
-			/* Mouse is handled by DirectInput when fullscreen */
-			if ( SDL_VideoSurface && ! DINPUT_FULLSCREEN() ) {
-				Sint16 x, y;
 
+#ifdef WM_MOUSELEAVE
+			/* No need to handle SDL_APPMOUSEFOCUS when fullscreen */
+			if ( SDL_VideoSurface && !FULLSCREEN() ) {
 				/* mouse has entered the window */
-				if ( ! in_window ) {
-#ifdef WM_MOUSELEAVE
+
+				if ( !(SDL_GetAppState() & SDL_APPMOUSEFOCUS) ) {
 					TRACKMOUSEEVENT tme;
 
 					tme.cbSize = sizeof(tme);
 					tme.dwFlags = TME_LEAVE;
 					tme.hwndTrack = SDL_Window;
 					_TrackMouseEvent(&tme);
-#endif /* WM_MOUSELEAVE */
-					in_window = TRUE;
-
-					posted = SDL_PrivateAppActive(1, SDL_APPMOUSEFOCUS);
-				}
-
-				/* mouse has moved within the window */
-				x = LOWORD(lParam);
-				y = HIWORD(lParam);
-				if ( mouse_relative ) {
-					POINT center;
-					center.x = (SDL_VideoSurface->w/2);
-					center.y = (SDL_VideoSurface->h/2);
-					x -= (Sint16)center.x;
-					y -= (Sint16)center.y;
-					if ( x || y ) {
-						ClientToScreen(SDL_Window, &center);
-						SetCursorPos(center.x, center.y);
-						posted = SDL_PrivateMouseMotion(0, 1, x, y);
-					}
-				} else {
-#ifdef SDL_VIDEO_DRIVER_GAPI
-					if (SDL_VideoSurface && this->hidden->gapiInfo)
-						GapiTransform(this->hidden->gapiInfo->coordinateTransform, this->hidden->gapiInfo->hiresFix, &x, &y);
-#endif
-					posted = SDL_PrivateMouseMotion(0, 0, x, y);
 				}
 			}
+#endif /* WM_MOUSELEAVE */
+
+			/* Mouse motion is handled in DIB_PumpEvents or
+			 * DX5_PumpEvents, depending on the video driver
+			 * in use */
+
+			posted = SDL_PrivateAppActive(1, SDL_APPMOUSEFOCUS);
 		}
 		return(0);
 
 #ifdef WM_MOUSELEAVE
 		case WM_MOUSELEAVE: {
 
-			/* Mouse is handled by DirectInput when fullscreen */
-			if ( SDL_VideoSurface && ! DINPUT_FULLSCREEN() ) {
+			/* No need to handle SDL_APPMOUSEFOCUS when fullscreen */
+			if ( SDL_VideoSurface && !FULLSCREEN() ) {
 				/* mouse has left the window */
 				/* or */
 				/* Elvis has left the building! */
 				posted = SDL_PrivateAppActive(0, SDL_APPMOUSEFOCUS);
 			}
-			in_window = FALSE;
 		}
 		return(0);
 #endif /* WM_MOUSELEAVE */
@@ -571,20 +550,8 @@
 						mouse_pressed = 0;
 					}
 				}
-				if ( mouse_relative ) {
-				/*	RJR: March 28, 2000
-					report internal mouse position if in relative mode */
-					x = 0; y = 0;
-				} else {
-					x = (Sint16)LOWORD(lParam);
-					y = (Sint16)HIWORD(lParam);
-#ifdef SDL_VIDEO_DRIVER_GAPI
-					if (SDL_VideoSurface && this->hidden->gapiInfo)
-						GapiTransform(this->hidden->gapiInfo->coordinateTransform, this->hidden->gapiInfo->hiresFix, &x, &y);
-#endif
-				}
 				posted = SDL_PrivateMouseButton(
-							state, button, x, y);
+							state, button, 0, 0);
 
 				/*
 				 * MSDN says: