Fix DPI with 0 width/hight reported by xorg (#544)
* Fix DPI with 0 width/hight reported by xorg * Add `WINIT_HIDPI_FACTOR` env variable It is now possible to override the DPI factor using the `WINIT_HIDPI_FACTOR` environment variable on X11. The changelog also has been updated to introduce all current changes made. * Add documentation for the environment variable * Fix nitpicks * Learning the alphabet * Panic with error message if DPI env var is <= 0
This commit is contained in:
parent
fd1a3eda1c
commit
bf413ecb83
3 changed files with 28 additions and 1 deletions
|
|
@ -344,6 +344,10 @@ impl Window {
|
|||
/// Returns the ratio between the backing framebuffer resolution and the
|
||||
/// window size in screen pixels. This is typically one for a normal display
|
||||
/// and two for a retina display.
|
||||
///
|
||||
/// ## Platform-specific
|
||||
/// On X11 the DPI factor can be overridden using the `WINIT_HIDPI_FACTOR` environment
|
||||
/// variable.
|
||||
#[inline]
|
||||
pub fn hidpi_factor(&self) -> f32 {
|
||||
self.window.hidpi_factor()
|
||||
|
|
@ -467,6 +471,10 @@ impl MonitorId {
|
|||
}
|
||||
|
||||
/// Returns the ratio between the monitor's physical pixels and logical pixels.
|
||||
///
|
||||
/// ## Platform-specific
|
||||
/// On X11 the DPI factor can be overridden using the `WINIT_HIDPI_FACTOR` environment
|
||||
/// variable.
|
||||
#[inline]
|
||||
pub fn get_hidpi_factor(&self) -> f32 {
|
||||
self.inner.get_hidpi_factor()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue