aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backends/platform/sdl/graphics.cpp4
-rw-r--r--engines/sci/graphics/cursor.cpp9
2 files changed, 5 insertions, 8 deletions
diff --git a/backends/platform/sdl/graphics.cpp b/backends/platform/sdl/graphics.cpp
index 83a256f568..721cc54c90 100644
--- a/backends/platform/sdl/graphics.cpp
+++ b/backends/platform/sdl/graphics.cpp
@@ -1377,6 +1377,10 @@ void OSystem_SDL::setMousePos(int x, int y) {
void OSystem_SDL::warpMouse(int x, int y) {
int y1 = y;
+ // Don't change mouse position, when mouse is outside of our window (in case of windowed mode)
+ if (!(SDL_GetAppState( ) & SDL_APPMOUSEFOCUS))
+ return;
+
if (_videoMode.aspectRatioCorrection && !_overlayVisible)
y1 = real2Aspect(y);
diff --git a/engines/sci/graphics/cursor.cpp b/engines/sci/graphics/cursor.cpp
index 14ab3fcdaf..38e9d389a6 100644
--- a/engines/sci/graphics/cursor.cpp
+++ b/engines/sci/graphics/cursor.cpp
@@ -219,6 +219,7 @@ void GfxCursor::kernelSetMacCursor(GuiResourceId viewNum, int loopNum, int celNu
// TODO: What about the 2000 resources? Inventory items? How to handle?
// TODO: What games does this work for? At least it does for KQ6.
// TODO: Stop asking rhetorical questions.
+ // TODO: It was fred all along!
Resource *resource = _resMan->findResource(ResourceId(kResourceTypeCursor, 1000 + celNum), false);
@@ -258,16 +259,12 @@ void GfxCursor::kernelSetMacCursor(GuiResourceId viewNum, int loopNum, int celNu
}
void GfxCursor::setPosition(Common::Point pos) {
- // This code has been disabled because it's annoying in windowed mode. The engine shouldn't move
- // the mouse cursor whenever it wants, it interferes with other programs
-#if 0
if (!_upscaledHires) {
g_system->warpMouse(pos.x, pos.y);
} else {
_screen->adjustToUpscaledCoordinates(pos.y, pos.x);
g_system->warpMouse(pos.x, pos.y);
}
-#endif
}
Common::Point GfxCursor::getPosition() {
@@ -293,9 +290,6 @@ Common::Point GfxCursor::getPosition() {
}
void GfxCursor::refreshPosition() {
- // This code has been disabled because it's annoying in windowed mode. The engine shouldn't move
- // the mouse cursor whenever it wants, it interferes with other programs
-#if 0
bool clipped = false;
Common::Point mousePoint = getPosition();
@@ -318,7 +312,6 @@ void GfxCursor::refreshPosition() {
// FIXME: Do this only when mouse is grabbed?
if (clipped)
setPosition(mousePoint);
-#endif
}
void GfxCursor::kernelSetMoveZone(Common::Rect zone) {