[Scummvm-git-logs] scummvm master -> e3a13c7d633d5eeb1d8546b76a263b85ed719ae9

lephilousophe noreply at scummvm.org
Sat Nov 2 20:43:00 UTC 2024


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
e3a13c7d63 ANDROID: Move mouse cursor while displaying keyboard


Commit: e3a13c7d633d5eeb1d8546b76a263b85ed719ae9
    https://github.com/scummvm/scummvm/commit/e3a13c7d633d5eeb1d8546b76a263b85ed719ae9
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2024-11-02T21:42:43+01:00

Commit Message:
ANDROID: Move mouse cursor while displaying keyboard

This is only for 2D for now.

Changed paths:
    backends/graphics/android/android-graphics.cpp
    backends/graphics/android/android-graphics.h


diff --git a/backends/graphics/android/android-graphics.cpp b/backends/graphics/android/android-graphics.cpp
index 1fdf5fdcf5e..9bf024c0780 100644
--- a/backends/graphics/android/android-graphics.cpp
+++ b/backends/graphics/android/android-graphics.cpp
@@ -165,6 +165,23 @@ void AndroidGraphicsManager::displayMessageOnOSD(const Common::U32String &msg) {
 	JNI::displayMessageOnOSD(msg);
 }
 
+void AndroidGraphicsManager::recalculateDisplayAreas() {
+	Common::Rect oldDrawRect = _gameDrawRect;
+
+	OpenGLGraphicsManager::recalculateDisplayAreas();
+
+	int offsetX = _gameDrawRect.left - oldDrawRect.left;
+	int offsetY = _gameDrawRect.top - oldDrawRect.top;
+
+	int newX = _cursorX + offsetX;
+	int newY = _cursorY + offsetY;
+
+	newX = CLIP<int16>(newX, _activeArea.drawRect.left, _activeArea.drawRect.right);
+	newY = CLIP<int16>(newY, _activeArea.drawRect.top, _activeArea.drawRect.bottom);
+
+	setMousePosition(newX, newY);
+}
+
 void AndroidGraphicsManager::showOverlay(bool inGUI) {
 	if (_overlayVisible && inGUI == _overlayInGUI)
 		return;
diff --git a/backends/graphics/android/android-graphics.h b/backends/graphics/android/android-graphics.h
index ab82e0a4743..1e8ba5f1d05 100644
--- a/backends/graphics/android/android-graphics.h
+++ b/backends/graphics/android/android-graphics.h
@@ -94,6 +94,7 @@ public:
 	void touchControlDraw(uint8 alpha, int16 x, int16 y, int16 w, int16 h, const Common::Rect &clip) override;
 
 protected:
+	void recalculateDisplayAreas() override;
 	void setSystemMousePosition(const int x, const int y) override {}
 
 	void showOverlay(bool inGUI) override;




More information about the Scummvm-git-logs mailing list