Fix bug #21915: Resolution selection dialog

The resolution selection dialog didn't set the selected resolution but a
lower one.

Instead of using the index from a filtered list on the unfiltered list,
the function is directly passed the filtered one.
This commit is contained in:
aquileia 2014-04-16 14:57:39 +02:00
parent 9e34f5d0bc
commit e93dfa01a8
2 changed files with 8 additions and 6 deletions

View file

@ -283,9 +283,6 @@ bool show_video_mode_dialog(display& disp)
for(size_t k = 0; k < resolutions.size(); ++k) {
std::pair<int, int> const& res = resolutions[k];
if(res.first < min_allowed_width() || res.second < min_allowed_height()) {
continue;
}
if (res == current_res)
current_choice = static_cast<unsigned>(k);

View file

@ -611,10 +611,15 @@ std::vector<std::pair<int, int> > CVideo::get_available_resolutions()
std::cerr << "No modes supported\n";
return result;
}
result.push_back(std::make_pair(getSurface()->w, getSurface()->h));
const std::pair<int,int> min_res = std::make_pair(preferences::min_allowed_width(),preferences::min_allowed_height());
if (getSurface()->w >= min_res.first && getSurface()->h >= min_res.second)
result.push_back(std::make_pair(getSurface()->w, getSurface()->h));
for(int i = 0; modes[i] != NULL; ++i) {
result.push_back(std::make_pair(modes[i]->w,modes[i]->h));
if (modes[i]->w >= min_res.first && modes[i]->h >= min_res.second)
result.push_back(std::make_pair(modes[i]->w,modes[i]->h));
}
std::sort(result.begin(), result.end());