Add MonitorHandle::current_video_mode()

This commit is contained in:
daxpedda 2024-07-21 00:01:43 +02:00
parent 1168cd4113
commit 2e53533cc1
No known key found for this signature in database
GPG key ID: 43D62A3EA388E46F
12 changed files with 167 additions and 79 deletions

View file

@ -1003,17 +1003,21 @@ impl MonitorHandle {
None
}
pub fn video_modes(&self) -> impl Iterator<Item = VideoModeHandle> {
pub fn current_video_mode(&self) -> Option<VideoModeHandle> {
let size = self.size().into();
// FIXME this is not the real refresh rate
// (it is guaranteed to support 32 bit color though)
std::iter::once(VideoModeHandle {
Some(VideoModeHandle {
size,
bit_depth: 32,
refresh_rate_millihertz: 60000,
monitor: self.clone(),
})
}
pub fn video_modes(&self) -> impl Iterator<Item = VideoModeHandle> {
self.current_video_mode().into_iter()
}
}
#[derive(Clone, Debug, Eq, Hash, PartialEq)]