[Scummvm-git-logs] scummvm master -> 7d816c23db59659ecfc1de87bec91cdbc28360a3

lephilousophe noreply at scummvm.org
Sat Jul 1 14:26:37 UTC 2023


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

Summary:
3a838c99f9 ANDROID: Various small fixes
d371b50d30 ANDROID: Add setting to to disable screen rotation
7d816c23db ANDROID: Reload keyboard on display configuration change


Commit: 3a838c99f944cdb54015ea39c308b5c7edcf4042
    https://github.com/scummvm/scummvm/commit/3a838c99f944cdb54015ea39c308b5c7edcf4042
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2023-07-01T16:26:19+02:00

Commit Message:
ANDROID: Various small fixes

- Comment and space fixes
- Remove outdated setting

Changed paths:
    backends/graphics/android/android-graphics.cpp
    backends/graphics3d/android/android-graphics3d.cpp
    backends/platform/android/options.cpp


diff --git a/backends/graphics/android/android-graphics.cpp b/backends/graphics/android/android-graphics.cpp
index 2803eb44ed3..d22a6066160 100644
--- a/backends/graphics/android/android-graphics.cpp
+++ b/backends/graphics/android/android-graphics.cpp
@@ -76,7 +76,7 @@ AndroidGraphicsManager::AndroidGraphicsManager() :
 	loadBuiltinTexture(JNI::BitmapResources::TOUCH_ARROWS_BITMAP, _touchcontrols);
 	_touchcontrols->updateGLTexture();
 
-	// not in 3D, not in overlay
+	// not in 3D, not in GUI
 	dynamic_cast<OSystem_Android *>(g_system)->applyTouchSettings(false, false);
 }
 
diff --git a/backends/graphics3d/android/android-graphics3d.cpp b/backends/graphics3d/android/android-graphics3d.cpp
index 32e8db790eb..cb115473c43 100644
--- a/backends/graphics3d/android/android-graphics3d.cpp
+++ b/backends/graphics3d/android/android-graphics3d.cpp
@@ -115,7 +115,7 @@ AndroidGraphics3dManager::AndroidGraphics3dManager() :
 
 	initSurface();
 
-	// in 3D, not in overlay
+	// in 3D, not in GUI
 	dynamic_cast<OSystem_Android *>(g_system)->applyTouchSettings(true, false);
 }
 
diff --git a/backends/platform/android/options.cpp b/backends/platform/android/options.cpp
index 2258a84c0b4..ed91cc17151 100644
--- a/backends/platform/android/options.cpp
+++ b/backends/platform/android/options.cpp
@@ -164,7 +164,7 @@ void AndroidOptionsWidget::defineLayout(GUI::ThemeEval &layouts, const Common::S
 	        .addLayout(GUI::ThemeLayout::kLayoutVertical)
 	            .addPadding(0, 0, 0, 0)
 	            .addWidget("OnScreenControl", "Checkbox")
-				.addWidget("PreferredTouchModeText", "", -1, layouts.getVar("Globals.Line.Height"));
+	            .addWidget("PreferredTouchModeText", "", -1, layouts.getVar("Globals.Line.Height"));
 
 	if (inAppDomain) {
 		layouts.addLayout(GUI::ThemeLayout::kLayoutHorizontal)
@@ -281,8 +281,7 @@ bool AndroidOptionsWidget::hasKeys() {
 	return ConfMan.hasKey("onscreen_control", _domain) ||
 	       (_domain.equalsIgnoreCase(Common::ConfigManager::kApplicationDomain) && ConfMan.hasKey("touch_mode_menus", _domain)) ||
 	       ConfMan.hasKey("touch_mode_2d_games", _domain) ||
-	       ConfMan.hasKey("touch_mode_3d_games", _domain) ||
-	       (_domain.equalsIgnoreCase(Common::ConfigManager::kApplicationDomain) && ConfMan.hasKey("onscreen_saf_revoke_btn", _domain));
+	       ConfMan.hasKey("touch_mode_3d_games", _domain);
 }
 
 void AndroidOptionsWidget::setEnabled(bool e) {
@@ -312,7 +311,6 @@ void OSystem_Android::registerDefaultSettings(const Common::String &target) cons
 	ConfMan.registerDefault("touch_mode_menus", "mouse");
 	ConfMan.registerDefault("touch_mode_2d_games", "touchpad");
 	ConfMan.registerDefault("touch_mode_3d_games", "gamepad");
-	ConfMan.registerDefault("onscreen_saf_revoke_btn", false);
 }
 
 void OSystem_Android::applyTouchSettings(bool _3dMode, bool overlayShown) {


Commit: d371b50d30d5c2af6bf0aedfa413919780e60c31
    https://github.com/scummvm/scummvm/commit/d371b50d30d5c2af6bf0aedfa413919780e60c31
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2023-07-01T16:26:19+02:00

Commit Message:
ANDROID: Add setting to to disable screen rotation

Changed paths:
    backends/graphics/android/android-graphics.cpp
    backends/graphics3d/android/android-graphics3d.cpp
    backends/platform/android/android.h
    backends/platform/android/jni-android.cpp
    backends/platform/android/jni-android.h
    backends/platform/android/options.cpp
    backends/platform/android/org/scummvm/scummvm/ScummVM.java
    backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java


diff --git a/backends/graphics/android/android-graphics.cpp b/backends/graphics/android/android-graphics.cpp
index d22a6066160..a545bfa5836 100644
--- a/backends/graphics/android/android-graphics.cpp
+++ b/backends/graphics/android/android-graphics.cpp
@@ -78,6 +78,7 @@ AndroidGraphicsManager::AndroidGraphicsManager() :
 
 	// not in 3D, not in GUI
 	dynamic_cast<OSystem_Android *>(g_system)->applyTouchSettings(false, false);
+	dynamic_cast<OSystem_Android *>(g_system)->applyOrientationSettings();
 }
 
 AndroidGraphicsManager::~AndroidGraphicsManager() {
@@ -181,6 +182,7 @@ void AndroidGraphicsManager::showOverlay(bool inGUI) {
 		_old_touch_mode = JNI::getTouchMode();
 		// not in 3D, in overlay
 		dynamic_cast<OSystem_Android *>(g_system)->applyTouchSettings(false, true);
+		dynamic_cast<OSystem_Android *>(g_system)->applyOrientationSettings();
 	} else if (_overlayInGUI) {
 		// Restore touch mode active before overlay was shown
 		JNI::setTouchMode(_old_touch_mode);
@@ -196,6 +198,7 @@ void AndroidGraphicsManager::hideOverlay() {
 	if (_overlayInGUI) {
 		// Restore touch mode active before overlay was shown
 		JNI::setTouchMode(_old_touch_mode);
+		dynamic_cast<OSystem_Android *>(g_system)->applyOrientationSettings();
 	}
 
 	OpenGL::OpenGLGraphicsManager::hideOverlay();
diff --git a/backends/graphics3d/android/android-graphics3d.cpp b/backends/graphics3d/android/android-graphics3d.cpp
index cb115473c43..fd8e452bd6e 100644
--- a/backends/graphics3d/android/android-graphics3d.cpp
+++ b/backends/graphics3d/android/android-graphics3d.cpp
@@ -117,6 +117,7 @@ AndroidGraphics3dManager::AndroidGraphics3dManager() :
 
 	// in 3D, not in GUI
 	dynamic_cast<OSystem_Android *>(g_system)->applyTouchSettings(true, false);
+	dynamic_cast<OSystem_Android *>(g_system)->applyOrientationSettings();
 }
 
 AndroidGraphics3dManager::~AndroidGraphics3dManager() {
@@ -547,6 +548,7 @@ void AndroidGraphics3dManager::showOverlay(bool inGUI) {
 		_old_touch_mode = JNI::getTouchMode();
 		// in 3D, in overlay
 		dynamic_cast<OSystem_Android *>(g_system)->applyTouchSettings(true, true);
+		dynamic_cast<OSystem_Android *>(g_system)->applyOrientationSettings();
 	} else if (_overlay_in_gui) {
 		// Restore touch mode active before overlay was shown
 		JNI::setTouchMode(_old_touch_mode);
@@ -606,6 +608,8 @@ void AndroidGraphics3dManager::hideOverlay() {
 		JNI::setTouchMode(_old_touch_mode);
 
 		warpMouse(_game_texture->width() / 2, _game_texture->height() / 2);
+
+		dynamic_cast<OSystem_Android *>(g_system)->applyOrientationSettings();
 	}
 
 	_overlay_in_gui = false;
diff --git a/backends/platform/android/android.h b/backends/platform/android/android.h
index 99308fe1f26..af18643028f 100644
--- a/backends/platform/android/android.h
+++ b/backends/platform/android/android.h
@@ -165,6 +165,12 @@ public:
 		TOUCH_MODE_MAX = 3
 	};
 
+	enum {
+		SCREEN_ORIENTATION_UNSPECIFIED = 0xffffffff,
+		SCREEN_ORIENTATION_LANDSCAPE = 0,
+		SCREEN_ORIENTATION_PORTRAIT = 1
+	};
+
 	OSystem_Android(int audio_sample_rate, int audio_buffer_size);
 	virtual ~OSystem_Android();
 
@@ -182,6 +188,8 @@ public:
 	void applyTouchSettings(bool _3dMode, bool overlayShown);
 	void setupTouchMode(int oldValue, int newValue);
 
+	void applyOrientationSettings();
+
 	bool pollEvent(Common::Event &event) override;
 	Common::HardwareInputSet *getHardwareInputSet() override;
 	Common::KeymapArray getGlobalKeymaps() override;
diff --git a/backends/platform/android/jni-android.cpp b/backends/platform/android/jni-android.cpp
index b60da9ccde9..705dbe139fa 100644
--- a/backends/platform/android/jni-android.cpp
+++ b/backends/platform/android/jni-android.cpp
@@ -93,6 +93,7 @@ jmethodID JNI::_MID_showKeyboardControl = 0;
 jmethodID JNI::_MID_getBitmapResource = 0;
 jmethodID JNI::_MID_setTouchMode = 0;
 jmethodID JNI::_MID_getTouchMode = 0;
+jmethodID JNI::_MID_setOrientation = 0;
 jmethodID JNI::_MID_getScummVMBasePath;
 jmethodID JNI::_MID_getScummVMConfigPath;
 jmethodID JNI::_MID_getScummVMLogPath;
@@ -508,6 +509,19 @@ int JNI::getTouchMode() {
 	return mode;
 }
 
+void JNI::setOrientation(int orientation) {
+	JNIEnv *env = JNI::getEnv();
+
+	env->CallVoidMethod(_jobj, _MID_setOrientation, orientation);
+
+	if (env->ExceptionCheck()) {
+		LOGE("Error trying to set orientation");
+
+		env->ExceptionDescribe();
+		env->ExceptionClear();
+	}
+}
+
 Common::String JNI::getScummVMBasePath() {
 	JNIEnv *env = JNI::getEnv();
 
@@ -769,6 +783,7 @@ void JNI::create(JNIEnv *env, jobject self, jobject asset_manager,
 	FIND_METHOD(, getBitmapResource, "(I)Landroid/graphics/Bitmap;");
 	FIND_METHOD(, setTouchMode, "(I)V");
 	FIND_METHOD(, getTouchMode, "()I");
+	FIND_METHOD(, setOrientation, "(I)V");
 	FIND_METHOD(, getScummVMBasePath, "()Ljava/lang/String;");
 	FIND_METHOD(, getScummVMConfigPath, "()Ljava/lang/String;");
 	FIND_METHOD(, getScummVMLogPath, "()Ljava/lang/String;");
diff --git a/backends/platform/android/jni-android.h b/backends/platform/android/jni-android.h
index 8073c838f03..9d9a08406bb 100644
--- a/backends/platform/android/jni-android.h
+++ b/backends/platform/android/jni-android.h
@@ -87,6 +87,7 @@ public:
 	static Graphics::Surface *getBitmapResource(BitmapResources resource);
 	static void setTouchMode(int touchMode);
 	static int getTouchMode();
+	static void setOrientation(int touchMode);
 	static void addSysArchivesToSearchSet(Common::SearchSet &s, int priority);
 	static Common::String getScummVMBasePath();
 	static Common::String getScummVMConfigPath();
@@ -148,6 +149,7 @@ private:
 	static jmethodID _MID_getBitmapResource;
 	static jmethodID _MID_setTouchMode;
 	static jmethodID _MID_getTouchMode;
+	static jmethodID _MID_setOrientation;
 	static jmethodID _MID_getScummVMBasePath;
 	static jmethodID _MID_getScummVMConfigPath;
 	static jmethodID _MID_getScummVMLogPath;
diff --git a/backends/platform/android/options.cpp b/backends/platform/android/options.cpp
index ed91cc17151..28cecb07b0f 100644
--- a/backends/platform/android/options.cpp
+++ b/backends/platform/android/options.cpp
@@ -77,12 +77,18 @@ private:
 	GUI::PopUpWidget *_preferredTM2DGamesPopUp;
 	GUI::StaticTextWidget *_preferredTM3DGamesDesc;
 	GUI::PopUpWidget *_preferredTM3DGamesPopUp;
+	GUI::StaticTextWidget *_orientationDesc;
+	GUI::StaticTextWidget *_orientationMenusDesc;
+	GUI::PopUpWidget *_orientationMenusPopUp;
+	GUI::StaticTextWidget *_orientationGamesDesc;
+	GUI::PopUpWidget *_orientationGamesPopUp;
 
 	bool _enabled;
 
-
 	uint32 loadTouchMode(const Common::String &setting, bool acceptDefault, uint32 defaultValue);
 	void saveTouchMode(const Common::String &setting, uint32 touchMode);
+	uint32 loadOrientation(const Common::String &setting, bool acceptDefault, uint32 defaultValue);
+	void saveOrientation(const Common::String &setting, uint32 orientation);
 };
 
 class SAFRemoveDialog : public GUI::Dialog {
@@ -110,6 +116,13 @@ enum {
 	kTouchModeGamepad,
 };
 
+enum {
+	kOrientationDefault = -1,
+	kOrientationAuto = 0,
+	kOrientationPortrait,
+	kOrientationLandscape,
+};
+
 AndroidOptionsWidget::AndroidOptionsWidget(GuiObject *boss, const Common::String &name, const Common::String &domain) :
 		OptionsContainerWidget(boss, name, "AndroidOptionsDialog", false, domain), _enabled(true) {
 
@@ -147,6 +160,29 @@ AndroidOptionsWidget::AndroidOptionsWidget(GuiObject *boss, const Common::String
 	_preferredTM2DGamesPopUp->appendEntry(_("Gamepad emulation"), kTouchModeGamepad);
 	_preferredTM3DGamesPopUp->appendEntry(_("Gamepad emulation"), kTouchModeGamepad);
 
+	_orientationDesc = new GUI::StaticTextWidget(widgetsBoss(), "AndroidOptionsDialog.OrientationText", _("Select the orientation:"));
+	if (inAppDomain) {
+		_orientationMenusDesc = new GUI::StaticTextWidget(widgetsBoss(), "AndroidOptionsDialog.OMenusText", _("In menus"));
+		_orientationMenusPopUp = new GUI::PopUpWidget(widgetsBoss(), "AndroidOptionsDialog.OMenus");
+		_orientationMenusPopUp->appendEntry(_("Automatic"), kOrientationAuto);
+		_orientationMenusPopUp->appendEntry(_("Portrait"), kOrientationPortrait);
+		_orientationMenusPopUp->appendEntry(_("Landscape"), kOrientationLandscape);
+	} else {
+		_orientationMenusDesc = nullptr;
+		_orientationMenusPopUp = nullptr;
+	}
+
+	_orientationGamesDesc = new GUI::StaticTextWidget(widgetsBoss(), "AndroidOptionsDialog.OGamesText", _("In games"));
+	_orientationGamesPopUp = new GUI::PopUpWidget(widgetsBoss(), "AndroidOptionsDialog.OGames");
+
+	if (!inAppDomain) {
+		_orientationGamesPopUp->appendEntry(_("<default>"), kOrientationDefault);
+	}
+
+	_orientationGamesPopUp->appendEntry(_("Automatic"), kOrientationAuto);
+	_orientationGamesPopUp->appendEntry(_("Portrait"), kOrientationPortrait);
+	_orientationGamesPopUp->appendEntry(_("Landscape"), kOrientationLandscape);
+
 	if (inAppDomain && AndroidFilesystemFactory::instance().hasSAF()) {
 		// Only show this checkbox in Options (via Options... in the launcher), and not at game domain level (via Edit Game...)
 		// I18N: This button opens a list of all folders added for Android Storage Attached Framework
@@ -183,6 +219,21 @@ void AndroidOptionsWidget::defineLayout(GUI::ThemeEval &layouts, const Common::S
 			.addWidget("TM3DGamesText", "OptionsLabel")
 			.addWidget("TM3DGames", "PopUp")
 		.closeLayout();
+
+	layouts.addWidget("OrientationText", "", -1, layouts.getVar("Globals.Line.Height"));
+	if (inAppDomain) {
+		layouts.addLayout(GUI::ThemeLayout::kLayoutHorizontal)
+			.addPadding(0, 0, 0, 0)
+			.addWidget("OMenusText", "OptionsLabel")
+			.addWidget("OMenus", "PopUp")
+		.closeLayout();
+	}
+	layouts.addLayout(GUI::ThemeLayout::kLayoutHorizontal)
+			.addPadding(0, 0, 0, 0)
+			.addWidget("OGamesText", "OptionsLabel")
+			.addWidget("OGames", "PopUp")
+		.closeLayout();
+
 	if (inAppDomain && AndroidFilesystemFactory::instance().hasSAF()) {
 		layouts.addWidget("ForgetSAFButton", "WideButton");
 	}
@@ -222,6 +273,23 @@ uint32 AndroidOptionsWidget::loadTouchMode(const Common::String &setting, bool a
 	}
 }
 
+uint32 AndroidOptionsWidget::loadOrientation(const Common::String &setting, bool acceptDefault, uint32 defaultValue) {
+	if (!acceptDefault || ConfMan.hasKey(setting, _domain)) {
+		Common::String orientation = ConfMan.get(setting, _domain);
+		if (orientation == "auto") {
+			return kOrientationAuto;
+		} else if (orientation == "portrait") {
+			return kOrientationPortrait;
+		} else if (orientation == "landscape") {
+			return kOrientationLandscape;
+		} else {
+			return defaultValue;
+		}
+	} else {
+		return kOrientationDefault;
+	}
+}
+
 void AndroidOptionsWidget::load() {
 	const bool inAppDomain = _domain.equalsIgnoreCase(Common::ConfigManager::kApplicationDomain);
 
@@ -233,6 +301,11 @@ void AndroidOptionsWidget::load() {
 	}
 	_preferredTM2DGamesPopUp->setSelectedTag(loadTouchMode("touch_mode_2d_games", !inAppDomain, kTouchModeTouchpad));
 	_preferredTM3DGamesPopUp->setSelectedTag(loadTouchMode("touch_mode_3d_games", !inAppDomain, kTouchModeGamepad));
+
+	if (inAppDomain) {
+		_orientationMenusPopUp->setSelectedTag(loadOrientation("orientation_menus", !inAppDomain, kOrientationAuto));
+	}
+	_orientationGamesPopUp->setSelectedTag(loadOrientation("orientation_games", !inAppDomain, kOrientationAuto));
 }
 
 void AndroidOptionsWidget::saveTouchMode(const Common::String &setting, uint32 touchMode) {
@@ -253,6 +326,24 @@ void AndroidOptionsWidget::saveTouchMode(const Common::String &setting, uint32 t
 	}
 }
 
+void AndroidOptionsWidget::saveOrientation(const Common::String &setting, uint32 orientation) {
+	switch (orientation) {
+	case kOrientationAuto:
+		ConfMan.set(setting, "auto", _domain);
+		break;
+	case kOrientationPortrait:
+		ConfMan.set(setting, "portrait", _domain);
+		break;
+	case kOrientationLandscape:
+		ConfMan.set(setting, "landscape", _domain);
+		break;
+	default:
+		// default
+		ConfMan.removeKey(setting, _domain);
+		break;
+	}
+}
+
 bool AndroidOptionsWidget::save() {
 	const bool inAppDomain = _domain.equalsIgnoreCase(Common::ConfigManager::kApplicationDomain);
 
@@ -264,6 +355,11 @@ bool AndroidOptionsWidget::save() {
 		}
 		saveTouchMode("touch_mode_2d_games", _preferredTM2DGamesPopUp->getSelectedTag());
 		saveTouchMode("touch_mode_3d_games", _preferredTM3DGamesPopUp->getSelectedTag());
+
+		if (inAppDomain) {
+			saveOrientation("orientation_menus", _orientationMenusPopUp->getSelectedTag());
+		}
+		saveOrientation("orientation_games", _orientationGamesPopUp->getSelectedTag());
 	} else {
 		ConfMan.removeKey("onscreen_control", _domain);
 
@@ -272,6 +368,11 @@ bool AndroidOptionsWidget::save() {
 		}
 		ConfMan.removeKey("touch_mode_2d_games", _domain);
 		ConfMan.removeKey("touch_mode_3d_games", _domain);
+
+		if (inAppDomain) {
+			ConfMan.removeKey("orientation_menus", _domain);
+		}
+		ConfMan.removeKey("orientation_games", _domain);
 	}
 
 	return true;
@@ -281,7 +382,9 @@ bool AndroidOptionsWidget::hasKeys() {
 	return ConfMan.hasKey("onscreen_control", _domain) ||
 	       (_domain.equalsIgnoreCase(Common::ConfigManager::kApplicationDomain) && ConfMan.hasKey("touch_mode_menus", _domain)) ||
 	       ConfMan.hasKey("touch_mode_2d_games", _domain) ||
-	       ConfMan.hasKey("touch_mode_3d_games", _domain);
+	       ConfMan.hasKey("touch_mode_3d_games", _domain) ||
+	       (_domain.equalsIgnoreCase(Common::ConfigManager::kApplicationDomain) && ConfMan.hasKey("orientation_menus", _domain)) ||
+	       ConfMan.hasKey("orientation_games", _domain);
 }
 
 void AndroidOptionsWidget::setEnabled(bool e) {
@@ -299,6 +402,12 @@ void AndroidOptionsWidget::setEnabled(bool e) {
 	_preferredTM2DGamesPopUp->setEnabled(e);
 	_preferredTM3DGamesDesc->setEnabled(e);
 	_preferredTM3DGamesPopUp->setEnabled(e);
+	if (inAppDomain) {
+		_orientationMenusDesc->setEnabled(e);
+		_orientationMenusPopUp->setEnabled(e);
+	}
+	_orientationGamesDesc->setEnabled(e);
+	_orientationGamesPopUp->setEnabled(e);
 }
 
 
@@ -311,6 +420,8 @@ void OSystem_Android::registerDefaultSettings(const Common::String &target) cons
 	ConfMan.registerDefault("touch_mode_menus", "mouse");
 	ConfMan.registerDefault("touch_mode_2d_games", "touchpad");
 	ConfMan.registerDefault("touch_mode_3d_games", "gamepad");
+	ConfMan.registerDefault("orientation_menus", "auto");
+	ConfMan.registerDefault("orientation_games", "auto");
 }
 
 void OSystem_Android::applyTouchSettings(bool _3dMode, bool overlayShown) {
@@ -340,6 +451,30 @@ void OSystem_Android::applyTouchSettings(bool _3dMode, bool overlayShown) {
 	}
 }
 
+void OSystem_Android::applyOrientationSettings() {
+	const Common::String activeDomain = ConfMan.getActiveDomainName();
+	const bool inAppDomain = activeDomain.empty() ||
+		activeDomain.equalsIgnoreCase(Common::ConfigManager::kApplicationDomain);
+
+	Common::String setting;
+
+	if (inAppDomain) {
+		setting = "orientation_menus";
+	} else {
+		setting = "orientation_games";
+	}
+
+	Common::String orientation = ConfMan.get(setting);
+	if (orientation == "portrait") {
+		JNI::setOrientation(SCREEN_ORIENTATION_PORTRAIT);
+	} else if (orientation == "landscape") {
+		JNI::setOrientation(SCREEN_ORIENTATION_LANDSCAPE);
+	// auto and everything else
+	} else {
+		JNI::setOrientation(SCREEN_ORIENTATION_UNSPECIFIED);
+	}
+}
+
 void OSystem_Android::applyBackendSettings() {
 	JNI::showKeyboardControl(ConfMan.getBool("onscreen_control"));
 }
diff --git a/backends/platform/android/org/scummvm/scummvm/ScummVM.java b/backends/platform/android/org/scummvm/scummvm/ScummVM.java
index 1f2ad20c702..bcf637fd2b4 100644
--- a/backends/platform/android/org/scummvm/scummvm/ScummVM.java
+++ b/backends/platform/android/org/scummvm/scummvm/ScummVM.java
@@ -78,6 +78,7 @@ public abstract class ScummVM implements SurfaceHolder.Callback, Runnable {
 	abstract protected Bitmap getBitmapResource(int resource);
 	abstract protected void setTouchMode(int touchMode);
 	abstract protected int getTouchMode();
+	abstract protected void setOrientation(int orientation);
 	abstract protected String getScummVMBasePath();
 	abstract protected String getScummVMConfigPath();
 	abstract protected String getScummVMLogPath();
diff --git a/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java b/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
index 199075ab7fc..77a8f606e32 100644
--- a/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
+++ b/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
@@ -784,6 +784,15 @@ public class ScummVMActivity extends Activity implements OnKeyboardVisibilityLis
 			return _events.getTouchMode();
 		}
 
+		@Override
+		protected void setOrientation(final int orientation) {
+			runOnUiThread(new Runnable() {
+				public void run() {
+					setRequestedOrientation(orientation);
+				}
+			});
+		}
+
 		@Override
 		protected String getScummVMBasePath() {
 			return _actualScummVMDataDir.getPath();


Commit: 7d816c23db59659ecfc1de87bec91cdbc28360a3
    https://github.com/scummvm/scummvm/commit/7d816c23db59659ecfc1de87bec91cdbc28360a3
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2023-07-01T16:26:19+02:00

Commit Message:
ANDROID: Reload keyboard on display configuration change

This ensures that keyboard is properly resized

Changed paths:
    backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java


diff --git a/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java b/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
index 77a8f606e32..756581a7e74 100644
--- a/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
+++ b/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
@@ -300,6 +300,12 @@ public class ScummVMActivity extends Activity implements OnKeyboardVisibilityLis
 									mEventPressTime = -1;
 									mKeyRepeatedCount = -1;
 								}
+
+								@Override
+								public void onConfigurationChanged(Configuration newConfig) {
+									// Reload keyboard to adapt to the new size
+									ChangeKeyboard();
+								}
 							}
 
 							final BuiltInKeyboardView builtinKeyboard = new BuiltInKeyboardView(ScummVMActivity.this, null);




More information about the Scummvm-git-logs mailing list