Implement public API for high-DPI (#319)

* Implement public API for high-DPI #105

* Recover get_inner_size_points and get_inner_size_pixels and change their implementation assuming get_inner_size() returns size in pixels

* Update changelog for high-DPI changes
This commit is contained in:
kryptan 2017-10-17 14:56:38 +03:00 committed by tomaka
parent eff3440482
commit 48902297b7
12 changed files with 78 additions and 15 deletions

View file

@ -94,6 +94,11 @@ impl MonitorId {
&MonitorId::Wayland(ref m) => m.get_position(),
}
}
#[inline]
pub fn get_hidpi_factor(&self) -> f32 {
1.0
}
}
impl Window {

View file

@ -407,6 +407,11 @@ impl MonitorId {
// if we reach here, this monitor does not exist any more
(0,0)
}
#[inline]
pub fn get_hidpi_factor(&self) -> f32 {
1.0
}
}
// a handler to release the ressources acquired to draw the initial white screen as soon as

View file

@ -101,4 +101,9 @@ impl MonitorId {
pub fn get_position(&self) -> (u32, u32) {
self.position
}
#[inline]
pub fn get_hidpi_factor(&self) -> f32 {
1.0
}
}

View file

@ -473,7 +473,7 @@ impl Window2 {
#[inline]
pub fn get_inner_size(&self) -> Option<(u32, u32)> {
self.get_geometry().map(|(_, _, w, h, _)| ((w as f32 / self.hidpi_factor()) as u32, (h as f32 / self.hidpi_factor()) as u32))
self.get_geometry().map(|(_, _, w, h, _)| (w, h))
}
#[inline]