diff options
| author | Willem Jan Palenstijn | 2006-05-27 12:39:55 +0000 | 
|---|---|---|
| committer | Willem Jan Palenstijn | 2006-05-27 12:39:55 +0000 | 
| commit | fa3f1fc15cfeddd3f38231beb59454bb02509387 (patch) | |
| tree | 9483e1b02821c71dac49d789154bd8283ee63e99 /backends/sdl | |
| parent | ae191feb213d9965d67e88d29cce19a23bef9412 (diff) | |
| download | scummvm-rg350-fa3f1fc15cfeddd3f38231beb59454bb02509387.tar.gz scummvm-rg350-fa3f1fc15cfeddd3f38231beb59454bb02509387.tar.bz2 scummvm-rg350-fa3f1fc15cfeddd3f38231beb59454bb02509387.zip  | |
fix warpmouse in overlay-mode; fixes cursor jumps when opening menu
svn-id: r22679
Diffstat (limited to 'backends/sdl')
| -rw-r--r-- | backends/sdl/graphics.cpp | 28 | 
1 files changed, 16 insertions, 12 deletions
diff --git a/backends/sdl/graphics.cpp b/backends/sdl/graphics.cpp index 2021f77ce7..e61e673ea2 100644 --- a/backends/sdl/graphics.cpp +++ b/backends/sdl/graphics.cpp @@ -1088,8 +1088,11 @@ void OSystem_SDL::showOverlay() {  	// Since resolution could change, put mouse to adjusted position  	// Fixes bug #1349059 -	x = _mouseCurState.x; -	y = _mouseCurState.y; +	x = _mouseCurState.x * _scaleFactor; +	if (_adjustAspectRatio) +		y = real2Aspect(_mouseCurState.y) * _scaleFactor; +	else +		y = _mouseCurState.y * _scaleFactor;  	warpMouse(x, y); @@ -1108,8 +1111,10 @@ void OSystem_SDL::hideOverlay() {  	// Since resolution could change, put mouse to adjusted position  	// Fixes bug #1349059 -	x = _mouseCurState.x; -	y = _mouseCurState.y; +	x = _mouseCurState.x / _scaleFactor; +	y = _mouseCurState.y / _scaleFactor; +	if (_adjustAspectRatio) +		y = aspect2Real(y);  	warpMouse(x, y); @@ -1250,11 +1255,14 @@ void OSystem_SDL::setMousePos(int x, int y) {  void OSystem_SDL::warpMouse(int x, int y) {  	int y1 = y; -	if (_adjustAspectRatio) +	if (_adjustAspectRatio && !_overlayVisible)  		y1 = real2Aspect(y);  	if (_mouseCurState.x != x || _mouseCurState.y != y) { -		SDL_WarpMouse(x * _scaleFactor, y1 * _scaleFactor); +		if (!_overlayVisible)  +			SDL_WarpMouse(x * _scaleFactor, y1 * _scaleFactor); +		else +			SDL_WarpMouse(x, y1);  		// SDL_WarpMouse() generates a mouse movement event, so  		// setMousePos() would be called eventually. However, the @@ -1482,20 +1490,16 @@ void OSystem_SDL::drawMouse() {  		height = _screenHeight;  		dst.x = _mouseCurState.x - _mouseCurState.hotX;  		dst.y = _mouseCurState.y - _mouseCurState.hotY; +		dst.w = _mouseCurState.w; +		dst.h = _mouseCurState.h;  	} else {  		scale = 1;  		width = _overlayWidth;  		height = _overlayHeight;  		dst.x = _mouseCurState.x - _mouseCurState.hHotX;  		dst.y = _mouseCurState.y - _mouseCurState.hHotY; -	} - -	if (_overlayVisible) {  		dst.w = _mouseCurState.hW;  		dst.h = _mouseCurState.hH; -	} else { -		dst.w = _mouseCurState.w; -		dst.h = _mouseCurState.h;  	}  	// Note that addDirtyRect() will perform any necessary clipping  | 
