You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
SDL2/SOURCES/0009-wayland-Round-the-refr...

37 lines
1.5 KiB

From cc40f732f9482eb45a1938a23d4f34265e78a729 Mon Sep 17 00:00:00 2001
From: Cameron Gutman <aicommander@gmail.com>
Date: Wed, 26 Jan 2022 21:09:39 -0600
Subject: [PATCH 09/11] wayland: Round the refresh rate rather than truncating
it
A 59999 mHz monitor should be reported as 60 Hz, not 59 Hz.
---
src/video/wayland/SDL_waylandvideo.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/video/wayland/SDL_waylandvideo.c b/src/video/wayland/SDL_waylandvideo.c
index 60d7403c7..61940cca4 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) {
--
2.34.1