Commit cc40f732f9482eb45a1938a23d4f34265e78a729

Cameron Gutman 2022-01-26T21:09:39

wayland: Round the refresh rate rather than truncating it A 59999 mHz monitor should be reported as 60 Hz, not 59 Hz.

diff --git a/src/video/wayland/SDL_waylandvideo.c b/src/video/wayland/SDL_waylandvideo.c
index 60d7403..61940cc 100644
--- a/src/video/wayland/SDL_waylandvideo.c
+++ b/src/video/wayland/SDL_waylandvideo.c
@@ -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) {