From 32d0e4c15fb33f80db194087850466664a43516a Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 19 Feb 2011 20:44:06 +0100 Subject: OPENGLSDL: Avoid warping in warpMouse when the logical coordinates did not change. This fixes a slight move of the mouse cursor when the hardware mouse position is at a subpixel from the logical coordinates. --- backends/graphics/openglsdl/openglsdl-graphics.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'backends/graphics/openglsdl') diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp index b10c94b03f..c7ce0aa7de 100644 --- a/backends/graphics/openglsdl/openglsdl-graphics.cpp +++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp @@ -195,6 +195,18 @@ void OpenGLSdlGraphicsManager::warpMouse(int x, int y) { int scaledX = x; int scaledY = y; + int16 currentX = _cursorState.x; + int16 currentY = _cursorState.y; + + adjustMousePosition(currentX, currentY); + + // Do not adjust the real screen position, when the current game / overlay + // coordinates match the requested coordinates. This avoids a slight + // movement which might occur otherwise when the mouse is at a subpixel + // position. + if (x == currentX && y == currentY) + return; + if (_videoMode.mode == OpenGL::GFX_NORMAL) { if (_videoMode.hardwareWidth != _videoMode.overlayWidth) scaledX = scaledX * _videoMode.hardwareWidth / _videoMode.overlayWidth; -- cgit v1.2.3