Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

windows: Update `WindowsDisplay::frequency()` (#10476)

张小白104558115ff0
diff --git a/crates/gpui/src/platform/windows/display.rs b/crates/gpui/src/platform/windows/display.rs
index 64a641aebb3..151d0b7151e 100644
--- a/crates/gpui/src/platform/windows/display.rs
+++ b/crates/gpui/src/platform/windows/display.rs
@@ -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)
+ })
}
}