(Android) Fixed an issue where the application would go into a restart loop if the screen was internally rotated 90 or 270 degrees

This commit is contained in:
Leon Styhre 2024-11-30 10:17:28 +01:00
parent 1e79d7fce2
commit 67c7fa258b

View file

@ -1568,7 +1568,11 @@ void ViewController::reloadAll()
void ViewController::setWindowSizeChanged(const int width, const int height) void ViewController::setWindowSizeChanged(const int width, const int height)
{ {
#if defined(__ANDROID__) #if defined(__ANDROID__)
const std::pair<int, int> windowSize {Utils::Platform::Android::getWindowSize()}; std::pair<int, int> windowSize {Utils::Platform::Android::getWindowSize()};
const int screenRotation {Settings::getInstance()->getInt("ScreenRotate")};
if (screenRotation == 90 || screenRotation == 270)
windowSize = std::make_pair(windowSize.second, windowSize.first);
if (windowSize.first == static_cast<int>(mRenderer->getScreenWidth()) && if (windowSize.first == static_cast<int>(mRenderer->getScreenWidth()) &&
windowSize.second == static_cast<int>(mRenderer->getScreenHeight())) { windowSize.second == static_cast<int>(mRenderer->getScreenHeight())) {