Change Monitor dimensions functions to size functions (#911)
This commit is contained in:
parent
47b5dfa034
commit
ea5c21950c
12 changed files with 34 additions and 34 deletions
|
|
@ -120,10 +120,10 @@ impl MonitorHandle {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
pub fn dimensions(&self) -> PhysicalSize {
|
||||
pub fn size(&self) -> PhysicalSize {
|
||||
match self {
|
||||
&MonitorHandle::X(ref m) => m.dimensions(),
|
||||
&MonitorHandle::Wayland(ref m) => m.dimensions(),
|
||||
&MonitorHandle::X(ref m) => m.size(),
|
||||
&MonitorHandle::Wayland(ref m) => m.size(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -531,7 +531,7 @@ impl fmt::Debug for MonitorHandle {
|
|||
struct MonitorHandle {
|
||||
name: Option<String>,
|
||||
native_identifier: u32,
|
||||
dimensions: PhysicalSize,
|
||||
size: PhysicalSize,
|
||||
position: PhysicalPosition,
|
||||
hidpi_factor: i32,
|
||||
}
|
||||
|
|
@ -539,7 +539,7 @@ impl fmt::Debug for MonitorHandle {
|
|||
let monitor_id_proxy = MonitorHandle {
|
||||
name: self.name(),
|
||||
native_identifier: self.native_identifier(),
|
||||
dimensions: self.dimensions(),
|
||||
size: self.size(),
|
||||
position: self.position(),
|
||||
hidpi_factor: self.hidpi_factor(),
|
||||
};
|
||||
|
|
@ -560,7 +560,7 @@ impl MonitorHandle {
|
|||
self.mgr.with_info(&self.proxy, |id, _| id).unwrap_or(0)
|
||||
}
|
||||
|
||||
pub fn dimensions(&self) -> PhysicalSize {
|
||||
pub fn size(&self) -> PhysicalSize {
|
||||
match self.mgr.with_info(&self.proxy, |_, info| {
|
||||
info.modes
|
||||
.iter()
|
||||
|
|
@ -594,7 +594,7 @@ impl MonitorHandle {
|
|||
.unwrap_or(vec![])
|
||||
.into_iter()
|
||||
.map(|x| VideoMode {
|
||||
dimensions: (x.dimensions.0 as u32, x.dimensions.1 as u32),
|
||||
size: (x.dimensions.0 as u32, x.dimensions.1 as u32),
|
||||
refresh_rate: (x.refresh_rate as f32 / 1000.0).round() as u16,
|
||||
bit_depth: 32
|
||||
})
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ impl MonitorHandle {
|
|||
primary: bool,
|
||||
) -> Option<Self> {
|
||||
let (name, hidpi_factor, video_modes) = unsafe { xconn.get_output_info(resources, &repr)? };
|
||||
let (dimensions, position) = unsafe { (repr.dimensions(), repr.position()) };
|
||||
let (dimensions, position) = unsafe { (repr.size(), repr.position()) };
|
||||
let rect = util::AaRect::new(position, dimensions);
|
||||
Some(MonitorHandle {
|
||||
id,
|
||||
|
|
@ -93,7 +93,7 @@ impl MonitorHandle {
|
|||
self.id as u32
|
||||
}
|
||||
|
||||
pub fn dimensions(&self) -> PhysicalSize {
|
||||
pub fn size(&self) -> PhysicalSize {
|
||||
self.dimensions.into()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ impl MonitorRepr {
|
|||
}
|
||||
}
|
||||
|
||||
pub unsafe fn dimensions(&self) -> (u32, u32) {
|
||||
pub unsafe fn size(&self) -> (u32, u32) {
|
||||
match *self {
|
||||
MonitorRepr::Monitor(monitor) => ((*monitor).width as u32, (*monitor).height as u32),
|
||||
MonitorRepr::Crtc(crtc) => ((*crtc).width as u32, (*crtc).height as u32),
|
||||
|
|
@ -136,7 +136,7 @@ impl XConnection {
|
|||
};
|
||||
|
||||
VideoMode {
|
||||
dimensions: (x.width, x.height),
|
||||
size: (x.width, x.height),
|
||||
refresh_rate: (refresh_rate as f32 / 1000.0).round() as u16,
|
||||
bit_depth: bit_depth as u16,
|
||||
}
|
||||
|
|
@ -151,7 +151,7 @@ impl XConnection {
|
|||
dpi / 96.
|
||||
} else {
|
||||
calc_dpi_factor(
|
||||
repr.dimensions(),
|
||||
repr.size(),
|
||||
((*output_info).mm_width as u64, (*output_info).mm_height as u64),
|
||||
)
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue