mirror of https://github.com/OpenTTD/OpenTTD
Fix: [SDL2] only resolutions of the first display were shown (#11778)
parent
994bdff81e
commit
302ba93471
|
@ -1779,6 +1779,10 @@ bool ToggleFullScreen(bool fs)
|
||||||
void SortResolutions()
|
void SortResolutions()
|
||||||
{
|
{
|
||||||
std::sort(_resolutions.begin(), _resolutions.end());
|
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());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -59,13 +59,15 @@ static void FindResolutions()
|
||||||
{
|
{
|
||||||
_resolutions.clear();
|
_resolutions.clear();
|
||||||
|
|
||||||
for (int i = 0; i < SDL_GetNumDisplayModes(0); i++) {
|
for (int display = 0; display < SDL_GetNumVideoDisplays(); display++) {
|
||||||
SDL_DisplayMode mode;
|
for (int i = 0; i < SDL_GetNumDisplayModes(display); i++) {
|
||||||
SDL_GetDisplayMode(0, i, &mode);
|
SDL_DisplayMode mode;
|
||||||
|
SDL_GetDisplayMode(display, i, &mode);
|
||||||
|
|
||||||
if (mode.w < 640 || mode.h < 480) continue;
|
if (mode.w < 640 || mode.h < 480) continue;
|
||||||
if (std::find(_resolutions.begin(), _resolutions.end(), Dimension(mode.w, mode.h)) != _resolutions.end()) continue;
|
if (std::find(_resolutions.begin(), _resolutions.end(), Dimension(mode.w, mode.h)) != _resolutions.end()) continue;
|
||||||
_resolutions.emplace_back(mode.w, mode.h);
|
_resolutions.emplace_back(mode.w, mode.h);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We have found no resolutions, show the default list */
|
/* We have found no resolutions, show the default list */
|
||||||
|
|
Loading…
Reference in New Issue