diff --git a/src/changelog/unreleased.md b/src/changelog/unreleased.md index 272561000..cb53b417f 100644 --- a/src/changelog/unreleased.md +++ b/src/changelog/unreleased.md @@ -59,3 +59,4 @@ changelog entry. - On Wayland, ensure that external event loop is woken-up when using pump_events and integrating via `FD`. - On Wayland, apply fractional scaling to custom cursors. - On macOS, fixed `run_app_on_demand` returning without closing open windows. +- On macOS, fixed `VideoMode::refresh_rate_millihertz` for fractional refresh rates. diff --git a/src/platform_impl/macos/monitor.rs b/src/platform_impl/macos/monitor.rs index bf7ee708e..dab09039d 100644 --- a/src/platform_impl/macos/monitor.rs +++ b/src/platform_impl/macos/monitor.rs @@ -281,12 +281,12 @@ impl MonitorHandle { }; modes.into_iter().map(move |mode| { - let cg_refresh_rate_hertz = ffi::CGDisplayModeGetRefreshRate(mode).round() as i64; + let cg_refresh_rate_hertz = ffi::CGDisplayModeGetRefreshRate(mode); // CGDisplayModeGetRefreshRate returns 0.0 for any display that // isn't a CRT - let refresh_rate_millihertz = if cg_refresh_rate_hertz > 0 { - (cg_refresh_rate_hertz * 1000) as u32 + let refresh_rate_millihertz = if cg_refresh_rate_hertz > 0.0 { + (cg_refresh_rate_hertz * 1000.0).round() as u32 } else { refresh_rate_millihertz };