[Scummvm-git-logs] scummvm master -> e108637dddb4d072006a67e4c9fd3ced98bd3203
digitall
noreply at scummvm.org
Thu Apr 21 18:39:10 UTC 2022
This automated email contains information about 4 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
8c4eddc506 OPENPANDORA: Don't Disable Cursor at SDL Init for Open Pandora Builds
6368cf8b72 SDL: Allow Override of ShowMouse Method for SDL Graphics
9fa08ef10f OPENPANDORA: Override Mouse Related Methods in Graphics Manager Code
e108637ddd OPENPANDORA: Initial Hack Solution for Removing SDL Cursor Disable Calls
Commit: 8c4eddc5069e3db16f5debed878981d88e3cc2f2
https://github.com/scummvm/scummvm/commit/8c4eddc5069e3db16f5debed878981d88e3cc2f2
Author: D G Turner (digitall at scummvm.org)
Date: 2022-04-21T19:39:05+01:00
Commit Message:
OPENPANDORA: Don't Disable Cursor at SDL Init for Open Pandora Builds
This breaks the hack for SDL problems with touchscreen events at the
screen edges on this platform.
Changed paths:
backends/platform/sdl/sdl.cpp
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index d5b6b453240..784580cc9e1 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -157,8 +157,10 @@ void OSystem_SDL::init() {
SDL_EnableUNICODE(1);
#endif
+#if !defined(OPENPANDORA)
// Disable OS cursor
SDL_ShowCursor(SDL_DISABLE);
+#endif
if (_window == nullptr)
_window = new SdlWindow();
Commit: 6368cf8b720fdc99e9e2657282aaf6697b96bfa1
https://github.com/scummvm/scummvm/commit/6368cf8b720fdc99e9e2657282aaf6697b96bfa1
Author: D G Turner (digitall at scummvm.org)
Date: 2022-04-21T19:39:05+01:00
Commit Message:
SDL: Allow Override of ShowMouse Method for SDL Graphics
This will be required to fix the OpenPandora hack for libSDL issues
with screen limits needing to avoid calls to SDL_ShowCursor(SDL_DISABLE).
Changed paths:
backends/graphics/sdl/sdl-graphics.h
diff --git a/backends/graphics/sdl/sdl-graphics.h b/backends/graphics/sdl/sdl-graphics.h
index b00ffae014c..f7a014d1a83 100644
--- a/backends/graphics/sdl/sdl-graphics.h
+++ b/backends/graphics/sdl/sdl-graphics.h
@@ -93,7 +93,7 @@ public:
*/
virtual bool notifyMousePosition(Common::Point &mouse);
- bool showMouse(bool visible) override;
+ virtual bool showMouse(bool visible) override;
bool lockMouse(bool lock) override;
virtual bool saveScreenshot(const Common::String &filename) const { return false; }
Commit: 9fa08ef10f26aed0c7c73d536793fa3f7315379e
https://github.com/scummvm/scummvm/commit/9fa08ef10f26aed0c7c73d536793fa3f7315379e
Author: D G Turner (digitall at scummvm.org)
Date: 2022-04-21T19:39:05+01:00
Commit Message:
OPENPANDORA: Override Mouse Related Methods in Graphics Manager Code
This is required to make changes to avoid SDL_ShowCursor(SDL_DISABLE)
calls.
Changed paths:
backends/graphics/openpandora/op-graphics.cpp
backends/graphics/openpandora/op-graphics.h
diff --git a/backends/graphics/openpandora/op-graphics.cpp b/backends/graphics/openpandora/op-graphics.cpp
index e75bfc4e080..4431099b94b 100644
--- a/backends/graphics/openpandora/op-graphics.cpp
+++ b/backends/graphics/openpandora/op-graphics.cpp
@@ -66,4 +66,83 @@ void OPGraphicsManager::unloadGFXMode() {
SurfaceSdlGraphicsManager::unloadGFXMode();
}
+bool OPGraphicsManager::showMouse(bool visible) {
+ if (visible == _cursorVisible) {
+ return visible;
+ }
+
+ int showCursor = SDL_DISABLE;
+ if (visible) {
+ // _cursorX and _cursorY are currently always clipped to the active
+ // area, so we need to ask SDL where the system's mouse cursor is
+ // instead
+ int x, y;
+ SDL_GetMouseState(&x, &y);
+ if (!_activeArea.drawRect.contains(Common::Point(x, y))) {
+ showCursor = SDL_ENABLE;
+ }
+ }
+ SDL_ShowCursor(showCursor);
+
+ return WindowedGraphicsManager::showMouse(visible);
+}
+
+bool OPGraphicsManager::notifyMousePosition(Common::Point &mouse) {
+ mouse.x = CLIP<int16>(mouse.x, 0, _windowWidth - 1);
+ mouse.y = CLIP<int16>(mouse.y, 0, _windowHeight - 1);
+
+ int showCursor = SDL_DISABLE;
+ // Currently on macOS we need to scale the events for HiDPI screen, but on
+ // Windows we do not. We can find out if we need to do it by querying the
+ // SDL window size vs the SDL drawable size.
+ float dpiScale = _window->getSdlDpiScalingFactor();
+ mouse.x = (int)(mouse.x * dpiScale + 0.5f);
+ mouse.y = (int)(mouse.y * dpiScale + 0.5f);
+ bool valid = true;
+ if (_activeArea.drawRect.contains(mouse)) {
+ _cursorLastInActiveArea = true;
+ } else {
+ // The right/bottom edges are not part of the drawRect. As the clipping
+ // is done in drawable area coordinates, but the mouse position is set
+ // in window coordinates, we need to subtract as many pixels from the
+ // edges as corresponds to one pixel in the window coordinates.
+ mouse.x = CLIP<int>(mouse.x, _activeArea.drawRect.left,
+ _activeArea.drawRect.right - (int)(1 * dpiScale + 0.5f));
+ mouse.y = CLIP<int>(mouse.y, _activeArea.drawRect.top,
+ _activeArea.drawRect.bottom - (int)(1 * dpiScale + 0.5f));
+
+ if (_window->mouseIsGrabbed() ||
+ // Keep the mouse inside the game area during dragging to prevent an
+ // event mismatch where the mouseup event gets lost because it is
+ // performed outside of the game area
+ (_cursorLastInActiveArea && SDL_GetMouseState(nullptr, nullptr) != 0)) {
+ setSystemMousePosition(mouse.x, mouse.y);
+ } else {
+ // Allow the in-game mouse to get a final movement event to the edge
+ // of the window if the mouse was moved out of the game area
+ if (_cursorLastInActiveArea) {
+ _cursorLastInActiveArea = false;
+ } else if (_cursorVisible) {
+ // Keep sending events to the game if the cursor is invisible,
+ // since otherwise if a game lets you skip a cutscene by
+ // clicking and the user moved the mouse outside the active
+ // area, the clicks wouldn't do anything, which would be
+ // confusing
+ valid = false;
+ }
+
+ if (_cursorVisible) {
+ showCursor = SDL_ENABLE;
+ }
+ }
+ }
+
+ SDL_ShowCursor(showCursor);
+ if (valid) {
+ setMousePosition(mouse.x, mouse.y);
+ mouse = convertWindowToVirtual(mouse.x, mouse.y);
+ }
+ return valid;
+}
+
#endif
diff --git a/backends/graphics/openpandora/op-graphics.h b/backends/graphics/openpandora/op-graphics.h
index 0170698f2f9..1362c2e2806 100644
--- a/backends/graphics/openpandora/op-graphics.h
+++ b/backends/graphics/openpandora/op-graphics.h
@@ -30,6 +30,9 @@ public:
bool loadGFXMode() override;
void unloadGFXMode() override;
+
+ bool showMouse(bool visible) override;
+ bool notifyMousePosition(Common::Point &mouse);
};
#endif /* BACKENDS_GRAPHICS_OP_H */
Commit: e108637dddb4d072006a67e4c9fd3ced98bd3203
https://github.com/scummvm/scummvm/commit/e108637dddb4d072006a67e4c9fd3ced98bd3203
Author: D G Turner (digitall at scummvm.org)
Date: 2022-04-21T19:39:05+01:00
Commit Message:
OPENPANDORA: Initial Hack Solution for Removing SDL Cursor Disable Calls
This likely needs further work after some testing with OpenPandora toolchain
to check that this builds a working binary and a basic test to see if this
fixes the reported issue which has been present after v1.7.0 release which
did not exhibit this problem.
Changed paths:
backends/graphics/openpandora/op-graphics.cpp
diff --git a/backends/graphics/openpandora/op-graphics.cpp b/backends/graphics/openpandora/op-graphics.cpp
index 4431099b94b..0ddc7315f43 100644
--- a/backends/graphics/openpandora/op-graphics.cpp
+++ b/backends/graphics/openpandora/op-graphics.cpp
@@ -82,7 +82,7 @@ bool OPGraphicsManager::showMouse(bool visible) {
showCursor = SDL_ENABLE;
}
}
- SDL_ShowCursor(showCursor);
+ //SDL_ShowCursor(showCursor);
return WindowedGraphicsManager::showMouse(visible);
}
@@ -137,7 +137,7 @@ bool OPGraphicsManager::notifyMousePosition(Common::Point &mouse) {
}
}
- SDL_ShowCursor(showCursor);
+ //SDL_ShowCursor(showCursor);
if (valid) {
setMousePosition(mouse.x, mouse.y);
mouse = convertWindowToVirtual(mouse.x, mouse.y);
More information about the Scummvm-git-logs
mailing list