aboutsummaryrefslogtreecommitdiff
path: root/backends/graphics/openglsdl
diff options
context:
space:
mode:
authorJohannes Schickel2011-02-19 20:44:06 +0100
committerJohannes Schickel2011-02-19 20:46:47 +0100
commit32d0e4c15fb33f80db194087850466664a43516a (patch)
treefe3c8288fd87b325d1059f52953bb5501c04f8b9 /backends/graphics/openglsdl
parent9954eb5a996a137a9a26abb766212e3fa471e3fe (diff)
downloadscummvm-rg350-32d0e4c15fb33f80db194087850466664a43516a.tar.gz
scummvm-rg350-32d0e4c15fb33f80db194087850466664a43516a.tar.bz2
scummvm-rg350-32d0e4c15fb33f80db194087850466664a43516a.zip
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.
Diffstat (limited to 'backends/graphics/openglsdl')
-rw-r--r--backends/graphics/openglsdl/openglsdl-graphics.cpp12
1 files changed, 12 insertions, 0 deletions
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;