Remove MonitorHandle::size/refresh_rate_millihertz()

This commit is contained in:
daxpedda 2024-07-21 00:40:57 +02:00
parent 2e53533cc1
commit 0ffcfd8a3a
No known key found for this signature in database
GPG key ID: 43D62A3EA388E46F
13 changed files with 81 additions and 218 deletions

View file

@ -71,24 +71,6 @@ impl MonitorHandle {
})
}
pub fn refresh_rate_millihertz(&self) -> Option<u32> {
None
}
pub fn size(&self) -> PhysicalSize<u32> {
self.inner.queue(|inner| {
let width = inner.screen.width().unwrap();
let height = inner.screen.height().unwrap();
if let Some(Engine::Chromium) = inner.engine {
PhysicalSize::new(width, height).cast()
} else {
LogicalSize::new(width, height)
.to_physical(super::web_sys::scale_factor(&inner.window))
}
})
}
pub fn current_video_mode(&self) -> Option<VideoModeHandle> {
Some(VideoModeHandle(self.clone()))
}
@ -291,15 +273,25 @@ pub struct VideoModeHandle(pub(super) MonitorHandle);
impl VideoModeHandle {
pub fn size(&self) -> PhysicalSize<u32> {
self.0.size()
self.0.inner.queue(|inner| {
let width = inner.screen.width().unwrap();
let height = inner.screen.height().unwrap();
if let Some(Engine::Chromium) = inner.engine {
PhysicalSize::new(width, height).cast()
} else {
LogicalSize::new(width, height)
.to_physical(super::web_sys::scale_factor(&inner.window))
}
})
}
pub fn bit_depth(&self) -> u16 {
self.0.inner.queue(|inner| inner.screen.color_depth().unwrap()).try_into().unwrap()
}
pub fn refresh_rate_millihertz(&self) -> u32 {
0
pub fn refresh_rate_millihertz(&self) -> Option<u32> {
None
}
pub fn monitor(&self) -> MonitorHandle {