src/video/windib/SDL_dibevents.c
branchSDL-1.2
changeset 4167 a6f635e5eaa6
parent 4162 3b7fc3416601
child 4170 092c0bc69155
     1.1 --- a/src/video/windib/SDL_dibevents.c	Thu Apr 02 04:09:40 2009 +0000
     1.2 +++ b/src/video/windib/SDL_dibevents.c	Thu Apr 02 04:43:36 2009 +0000
     1.3 @@ -271,6 +271,36 @@
     1.4  	return(DefWindowProc(hwnd, msg, wParam, lParam));
     1.5  }
     1.6  
     1.7 +static void DIB_GenerateMouseMotionEvent(void)
     1.8 +{
     1.9 +	extern int mouse_relative;
    1.10 +	extern int posted;
    1.11 +
    1.12 +	POINT mouse;
    1.13 +	GetCursorPos( &mouse );
    1.14 +
    1.15 +	if ( mouse_relative ) {
    1.16 +		POINT center;
    1.17 +		center.x = (SDL_VideoSurface->w/2);
    1.18 +		center.y = (SDL_VideoSurface->h/2);
    1.19 +		ClientToScreen(SDL_Window, &center);
    1.20 +
    1.21 +		mouse.x -= (Sint16)center.x;
    1.22 +		mouse.y -= (Sint16)center.y;
    1.23 +		if ( mouse.x || mouse.y ) {
    1.24 +			SetCursorPos(center.x, center.y);
    1.25 +			posted = SDL_PrivateMouseMotion(0, 1, mouse.x, mouse.y);
    1.26 +		}
    1.27 +	} else if ( SDL_GetAppState() & SDL_APPMOUSEFOCUS ) {
    1.28 +		ScreenToClient(SDL_Window, &mouse);
    1.29 +#ifdef _WIN32_WCE
    1.30 +		if (SDL_VideoSurface)
    1.31 +			GapiTransform(this->hidden->userOrientation, this->hidden->hiresFix, &mouse.x, &mouse.y);
    1.32 +#endif
    1.33 +		posted = SDL_PrivateMouseMotion(0, 0, mouse.x, mouse.y);
    1.34 +	}
    1.35 +}
    1.36 +
    1.37  void DIB_PumpEvents(_THIS)
    1.38  {
    1.39  	MSG msg;
    1.40 @@ -280,6 +310,10 @@
    1.41  			DispatchMessage(&msg);
    1.42  		}
    1.43  	}
    1.44 +
    1.45 +	if ( SDL_GetAppState() & SDL_APPINPUTFOCUS ) {
    1.46 +		DIB_GenerateMouseMotionEvent( );
    1.47 +	}
    1.48  }
    1.49  
    1.50  static HKL hLayoutUS = NULL;