parent
41d2c52638
commit
e5d1cf84cf
1 changed files with 4 additions and 0 deletions
|
@ -1167,6 +1167,10 @@ impl LinuxClient for X11Client {
|
||||||
// Adatpted from:
|
// Adatpted from:
|
||||||
// https://docs.rs/winit/0.29.11/src/winit/platform_impl/linux/x11/monitor.rs.html#103-111
|
// https://docs.rs/winit/0.29.11/src/winit/platform_impl/linux/x11/monitor.rs.html#103-111
|
||||||
pub fn mode_refresh_rate(mode: &randr::ModeInfo) -> Duration {
|
pub fn mode_refresh_rate(mode: &randr::ModeInfo) -> Duration {
|
||||||
|
if mode.dot_clock == 0 || mode.htotal == 0 || mode.vtotal == 0 {
|
||||||
|
return Duration::from_millis(16);
|
||||||
|
}
|
||||||
|
|
||||||
let millihertz = mode.dot_clock as u64 * 1_000 / (mode.htotal as u64 * mode.vtotal as u64);
|
let millihertz = mode.dot_clock as u64 * 1_000 / (mode.htotal as u64 * mode.vtotal as u64);
|
||||||
let micros = 1_000_000_000 / millihertz;
|
let micros = 1_000_000_000 / millihertz;
|
||||||
log::info!("Refreshing at {} micros", micros);
|
log::info!("Refreshing at {} micros", micros);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue