Skip to content

Commit

Permalink
wayland: Round the refresh rate rather than truncating it
Browse files Browse the repository at this point in the history
A 59999 mHz monitor should be reported as 60 Hz, not 59 Hz.
  • Loading branch information
cgutman committed Jan 27, 2022
1 parent 3044310 commit cc40f73
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/video/wayland/SDL_waylandvideo.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit cc40f73

Please sign in to comment.