[Scummvm-git-logs] scummvm master -> 0786a222baa9d334a183a471f7f1f1b96385afa1
neuromancer
noreply at scummvm.org
Wed Nov 12 06:21:00 UTC 2025
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
0786a222ba PRIVATE: Update cursor when screen changes
Commit: 0786a222baa9d334a183a471f7f1f1b96385afa1
https://github.com/scummvm/scummvm/commit/0786a222baa9d334a183a471f7f1f1b96385afa1
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2025-11-12T07:20:56+01:00
Commit Message:
PRIVATE: Update cursor when screen changes
Fixes stale default cursor when changing screens without moving mouse.
Fixes unnecessary cursor changes on every mouse move event over areas
with non-default cursors.
Changed paths:
engines/private/private.cpp
engines/private/private.h
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index a52fdffc9aa..93b28c3ec92 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -344,10 +344,9 @@ Common::Error PrivateEngine::run() {
}
_needToDrawScreenFrame = false;
- bool needsUpdate = false;
while (!shouldQuit()) {
- needsUpdate = false;
+ bool mouseMoved = false;
checkPhoneCall();
while (g_system->getEventManager()->pollEvent(event)) {
@@ -402,15 +401,8 @@ Common::Error PrivateEngine::run() {
break;
case Common::EVENT_MOUSEMOVE:
- needsUpdate = true;
- // Reset cursor to default
- changeCursor("default");
- // The following functions will return true
- // if the cursor is changed
- if (cursorPauseMovie(mousePos)) {
- } else if (cursorMask(mousePos)) {
- } else
- cursorExit(mousePos);
+ mouseMoved = true;
+ updateCursor(mousePos);
break;
default:
@@ -427,6 +419,7 @@ Common::Error PrivateEngine::run() {
playVideo(_nextMovie);
_currentMovie = _nextMovie;
_nextMovie = "";
+ updateCursor(mousePos);
continue;
}
@@ -450,7 +443,7 @@ Common::Error PrivateEngine::run() {
g_system->clearOverlay();
}
_currentMovie = "";
- } else if (!_videoDecoder->needsUpdate() && needsUpdate) {
+ } else if (!_videoDecoder->needsUpdate() && mouseMoved) {
g_system->updateScreen();
} else if (_videoDecoder->needsUpdate()) {
drawScreen();
@@ -468,13 +461,13 @@ Common::Error PrivateEngine::run() {
_nextSetting = "";
_currentVS = "";
Gen::g_vm->run();
- changeCursor("default");
// Draw the screen once the VM has processed the last setting.
// This prevents the screen from flickering images as VM settings
// are executed. Fixes the previous screen from being displayed
// when a video finishes playing.
if (_nextSetting.empty()) {
+ updateCursor(mousePos);
drawScreen();
}
}
@@ -586,6 +579,20 @@ void PrivateEngine::checkPoliceBust() {
}
}
+void PrivateEngine::updateCursor(Common::Point mousePos) {
+ // If a function returns true then it changed the cursor.
+ if (cursorPauseMovie(mousePos)) {
+ return;
+ }
+ if (cursorMask(mousePos)) {
+ return;
+ }
+ if (cursorExit(mousePos)) {
+ return;
+ }
+ changeCursor("default");
+}
+
bool PrivateEngine::cursorExit(Common::Point mousePos) {
mousePos = mousePos - _origin;
if (mousePos.x < 0 || mousePos.y < 0)
@@ -655,6 +662,7 @@ bool PrivateEngine::cursorPauseMovie(Common::Point mousePos) {
uint32 tol = 15;
Common::Rect window(_origin.x - tol, _origin.y - tol, _screenW - _origin.x + tol, _screenH - _origin.y + tol);
if (!window.contains(mousePos)) {
+ changeCursor("default");
return true;
}
}
diff --git a/engines/private/private.h b/engines/private/private.h
index 680a249c7a5..de1437399ce 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -216,6 +216,7 @@ public:
void resumeGame();
// Cursors
+ void updateCursor(Common::Point);
bool cursorPauseMovie(Common::Point);
bool cursorExit(Common::Point);
bool cursorMask(Common::Point);
More information about the Scummvm-git-logs
mailing list