mirror of
https://github.com/zed-industries/zed.git
synced 2024-09-19 18:41:56 +03:00
windows: Update WindowsDisplay::frequency()
(#10476)
A subsequent update introduced the `HMONITOR` value to the `WindowsDisplay` struct, eliminating the need for polling to retrieve this value. Release Notes: - N/A
This commit is contained in:
parent
4e6f24a841
commit
104558115f
@ -121,21 +121,18 @@ impl WindowsDisplay {
|
||||
}
|
||||
|
||||
pub(crate) fn frequency(&self) -> Option<u32> {
|
||||
available_monitors()
|
||||
.get(self.display_id.0 as usize)
|
||||
.and_then(|hmonitor| get_monitor_info(*hmonitor).ok())
|
||||
.and_then(|info| {
|
||||
let mut devmode = DEVMODEW::default();
|
||||
unsafe {
|
||||
EnumDisplaySettingsW(
|
||||
PCWSTR(info.szDevice.as_ptr()),
|
||||
ENUM_CURRENT_SETTINGS,
|
||||
&mut devmode,
|
||||
)
|
||||
}
|
||||
.as_bool()
|
||||
.then(|| devmode.dmDisplayFrequency)
|
||||
})
|
||||
get_monitor_info(self.handle).ok().and_then(|info| {
|
||||
let mut devmode = DEVMODEW::default();
|
||||
unsafe {
|
||||
EnumDisplaySettingsW(
|
||||
PCWSTR(info.szDevice.as_ptr()),
|
||||
ENUM_CURRENT_SETTINGS,
|
||||
&mut devmode,
|
||||
)
|
||||
}
|
||||
.as_bool()
|
||||
.then(|| devmode.dmDisplayFrequency)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user