wayland: Round the refresh rate rather than truncating it

A 59999 mHz monitor should be reported as 60 Hz, not 59 Hz.
This commit is contained in:
Cameron Gutman 2022-01-26 21:09:39 -06:00
parent 3044310518
commit cc40f732f9
1 changed files with 2 additions and 2 deletions

View File

@ -393,7 +393,7 @@ display_handle_mode(void *data,
mode.w = width;
mode.h = height;
}
mode.refresh_rate = refresh / 1000; /* mHz to Hz */
mode.refresh_rate = (int)SDL_round(refresh / 1000.0); /* mHz to Hz */
mode.driverdata = driverdata->output;
if (driverdata->index > -1) {
SDL_AddDisplayMode(SDL_GetDisplay(driverdata->index), &mode);
@ -446,7 +446,7 @@ display_handle_done(void *data,
((float) driverdata->physical_width) / 25.4f,
((float) driverdata->physical_height) / 25.4f);
}
mode.refresh_rate = driverdata->refresh / 1000; /* mHz to Hz */
mode.refresh_rate = (int)SDL_round(driverdata->refresh / 1000.0); /* mHz to Hz */
mode.driverdata = driverdata->output;
if (driverdata->index > -1) {