@@ -1776,12 +1776,16 @@ bool ToggleFullScreen(bool fs)
return result;
}
void SortResolutions()
{
std::sort(_resolutions.begin(), _resolutions.end());
/* Remove any duplicates from the list. */
auto last = std::unique(_resolutions.begin(), _resolutions.end());
_resolutions.erase(last, _resolutions.end());
/**
* Resolve GUI zoom level, if auto-suggestion is requested.
*/
void UpdateGUIZoom()
@@ -56,19 +56,21 @@ static const Dimension default_resolutio
};
static void FindResolutions()
_resolutions.clear();
for (int i = 0; i < SDL_GetNumDisplayModes(0); i++) {
SDL_DisplayMode mode;
SDL_GetDisplayMode(0, i, &mode);
for (int display = 0; display < SDL_GetNumVideoDisplays(); display++) {
for (int i = 0; i < SDL_GetNumDisplayModes(display); i++) {
SDL_GetDisplayMode(display, i, &mode);
if (mode.w < 640 || mode.h < 480) continue;
if (std::find(_resolutions.begin(), _resolutions.end(), Dimension(mode.w, mode.h)) != _resolutions.end()) continue;
_resolutions.emplace_back(mode.w, mode.h);
/* We have found no resolutions, show the default list */
if (_resolutions.empty()) {
_resolutions.assign(std::begin(default_resolutions), std::end(default_resolutions));
Status change: