Fixed bug #611 SDL-1.2
authorSam Lantinga <slouken@libsdl.org>
Mon, 13 Apr 2009 08:38:04 +0000
branchSDL-1.2
changeset 416927c0db0fbfad
parent 4168 69bcba65c388
child 4170 092c0bc69155
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.
src/video/wincommon/SDL_sysevents.c
     1.1 --- a/src/video/wincommon/SDL_sysevents.c	Mon Apr 13 00:53:12 2009 +0000
     1.2 +++ b/src/video/wincommon/SDL_sysevents.c	Mon Apr 13 08:38:04 2009 +0000
     1.3 @@ -438,62 +438,41 @@
     1.4  		break;
     1.5  
     1.6  		case WM_MOUSEMOVE: {
     1.7 -			
     1.8 -			/* Mouse is handled by DirectInput when fullscreen */
     1.9 -			if ( SDL_VideoSurface && ! DINPUT_FULLSCREEN() ) {
    1.10 -				Sint16 x, y;
    1.11  
    1.12 +#ifdef WM_MOUSELEAVE
    1.13 +			/* No need to handle SDL_APPMOUSEFOCUS when fullscreen */
    1.14 +			if ( SDL_VideoSurface && !FULLSCREEN() ) {
    1.15  				/* mouse has entered the window */
    1.16 -				if ( ! in_window ) {
    1.17 -#ifdef WM_MOUSELEAVE
    1.18 +
    1.19 +				if ( !(SDL_GetAppState() & SDL_APPMOUSEFOCUS) ) {
    1.20  					TRACKMOUSEEVENT tme;
    1.21  
    1.22  					tme.cbSize = sizeof(tme);
    1.23  					tme.dwFlags = TME_LEAVE;
    1.24  					tme.hwndTrack = SDL_Window;
    1.25  					_TrackMouseEvent(&tme);
    1.26 -#endif /* WM_MOUSELEAVE */
    1.27 -					in_window = TRUE;
    1.28 -
    1.29 -					posted = SDL_PrivateAppActive(1, SDL_APPMOUSEFOCUS);
    1.30 -				}
    1.31 -
    1.32 -				/* mouse has moved within the window */
    1.33 -				x = LOWORD(lParam);
    1.34 -				y = HIWORD(lParam);
    1.35 -				if ( mouse_relative ) {
    1.36 -					POINT center;
    1.37 -					center.x = (SDL_VideoSurface->w/2);
    1.38 -					center.y = (SDL_VideoSurface->h/2);
    1.39 -					x -= (Sint16)center.x;
    1.40 -					y -= (Sint16)center.y;
    1.41 -					if ( x || y ) {
    1.42 -						ClientToScreen(SDL_Window, &center);
    1.43 -						SetCursorPos(center.x, center.y);
    1.44 -						posted = SDL_PrivateMouseMotion(0, 1, x, y);
    1.45 -					}
    1.46 -				} else {
    1.47 -#ifdef SDL_VIDEO_DRIVER_GAPI
    1.48 -					if (SDL_VideoSurface && this->hidden->gapiInfo)
    1.49 -						GapiTransform(this->hidden->gapiInfo->coordinateTransform, this->hidden->gapiInfo->hiresFix, &x, &y);
    1.50 -#endif
    1.51 -					posted = SDL_PrivateMouseMotion(0, 0, x, y);
    1.52  				}
    1.53  			}
    1.54 +#endif /* WM_MOUSELEAVE */
    1.55 +
    1.56 +			/* Mouse motion is handled in DIB_PumpEvents or
    1.57 +			 * DX5_PumpEvents, depending on the video driver
    1.58 +			 * in use */
    1.59 +
    1.60 +			posted = SDL_PrivateAppActive(1, SDL_APPMOUSEFOCUS);
    1.61  		}
    1.62  		return(0);
    1.63  
    1.64  #ifdef WM_MOUSELEAVE
    1.65  		case WM_MOUSELEAVE: {
    1.66  
    1.67 -			/* Mouse is handled by DirectInput when fullscreen */
    1.68 -			if ( SDL_VideoSurface && ! DINPUT_FULLSCREEN() ) {
    1.69 +			/* No need to handle SDL_APPMOUSEFOCUS when fullscreen */
    1.70 +			if ( SDL_VideoSurface && !FULLSCREEN() ) {
    1.71  				/* mouse has left the window */
    1.72  				/* or */
    1.73  				/* Elvis has left the building! */
    1.74  				posted = SDL_PrivateAppActive(0, SDL_APPMOUSEFOCUS);
    1.75  			}
    1.76 -			in_window = FALSE;
    1.77  		}
    1.78  		return(0);
    1.79  #endif /* WM_MOUSELEAVE */
    1.80 @@ -571,20 +550,8 @@
    1.81  						mouse_pressed = 0;
    1.82  					}
    1.83  				}
    1.84 -				if ( mouse_relative ) {
    1.85 -				/*	RJR: March 28, 2000
    1.86 -					report internal mouse position if in relative mode */
    1.87 -					x = 0; y = 0;
    1.88 -				} else {
    1.89 -					x = (Sint16)LOWORD(lParam);
    1.90 -					y = (Sint16)HIWORD(lParam);
    1.91 -#ifdef SDL_VIDEO_DRIVER_GAPI
    1.92 -					if (SDL_VideoSurface && this->hidden->gapiInfo)
    1.93 -						GapiTransform(this->hidden->gapiInfo->coordinateTransform, this->hidden->gapiInfo->hiresFix, &x, &y);
    1.94 -#endif
    1.95 -				}
    1.96  				posted = SDL_PrivateMouseButton(
    1.97 -							state, button, x, y);
    1.98 +							state, button, 0, 0);
    1.99  
   1.100  				/*
   1.101  				 * MSDN says: