Video: fix incorrect refresh rate value being returned (fixes #9594)

Regression from b859060627
This commit is contained in:
Charles Dang 2024-11-20 15:43:54 -05:00
parent 6fb5488464
commit bb4eb0bf1b
2 changed files with 8 additions and 1 deletions

View file

@ -486,7 +486,11 @@ int get_pixel_scale()
int current_refresh_rate()
{
// TODO: this should be more clever, depending on usage
return std::min(prefs::get().refresh_rate(), refresh_rate_);
if(auto preferred = prefs::get().refresh_rate(); preferred > 0) {
return std::min(preferred, refresh_rate_);
} else {
return refresh_rate_;
}
}
void force_render_target(const texture& t)

View file

@ -135,6 +135,9 @@ std::vector<std::string> enumerate_drivers();
/**
* The refresh rate of the screen.
*
* In most cases, this will be the native refresh rate of the display, but
* could be lower if FPS has been artificially capped (i.e., through --max-fps).
*
* If a refresh cannot be detected, this may return 0, or it may return a
* substitute value.
*/