Pārlūkot izejas kodu

wayland: Round the refresh rate rather than truncating it

A 59999 mHz monitor should be reported as 60 Hz, not 59 Hz.
Cameron Gutman 3 gadi atpakaļ
vecāks
revīzija
cc40f732f9
1 mainītis faili ar 2 papildinājumiem un 2 dzēšanām
  1. 2 2
      src/video/wayland/SDL_waylandvideo.c

+ 2 - 2
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) {