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

pull/303/head
scrawl 7 years ago
parent 64e27c032b
commit 5b10e3128e

@ -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);

Loading…
Cancel
Save