1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-04 21:40:03 +00:00

Use first resolution in fullscreen if current is not supported (Fixes #4113)

This commit is contained in:
scrawl 2017-09-29 14:58:25 +00:00
parent 64e27c032b
commit 5b10e3128e

View File

@ -353,24 +353,31 @@ namespace MWGui
}
bool supported = false;
int fallbackX = 0, fallbackY = 0;
for (unsigned int i=0; i<mResolutionList->getItemCount(); ++i)
{
std::string resStr = mResolutionList->getItemNameAt(i);
int resX, resY;
parseResolution (resX, resY, resStr);
if (i == 0)
{
fallbackX = resX;
fallbackY = resY;
}
if (resX == Settings::Manager::getInt("resolution x", "Video")
&& resY == Settings::Manager::getInt("resolution y", "Video"))
supported = true;
}
if (!supported)
if (!supported && mResolutionList->getItemCount())
{
std::string msg = "This resolution is not supported in Fullscreen mode. Please select a resolution from the list.";
MWBase::Environment::get().getWindowManager()->
messageBox(msg);
_sender->castType<MyGUI::Button>()->setCaption(off);
return;
if (fallbackX != 0 && fallbackY != 0)
{
Settings::Manager::setInt("resolution x", "Video", fallbackX);
Settings::Manager::setInt("resolution y", "Video", fallbackY);
}
}
mWindowBorderButton->setEnabled(!newState);