aboutsummaryrefslogtreecommitdiff
path: root/src/display.rs
diff options
context:
space:
mode:
authorChristian Duerr <chrisduerr@users.noreply.github.com>2018-06-07 15:52:06 +0000
committerGitHub <noreply@github.com>2018-06-07 15:52:06 +0000
commit93780ef0929e08f3c5212e5451152ecaf1a28813 (patch)
tree51febe6a0d1c77d67e32bd2189fad2d7c39ab1d6 /src/display.rs
parent2fcdd40a81105128b12b9060c257c85e8be32306 (diff)
downloadr-alacritty-93780ef0929e08f3c5212e5451152ecaf1a28813.tar.gz
r-alacritty-93780ef0929e08f3c5212e5451152ecaf1a28813.tar.bz2
r-alacritty-93780ef0929e08f3c5212e5451152ecaf1a28813.zip
Allow disabling DPI scaling
This makes it possible to disable DPI scaling completely, instead the the display pixel ration will always be fixed to 1.0. By default nothing has changed and DPI is still enabled, this just seems like a better way than running `WINIT_HIDPI_FACTOR=1.0 alacritty` every time the user wants to start alacritty. It would be possible to allow specifying any DPR, however I've decided against this since I'd assume it's a very rare usecase. It's also still possible to make use of `WINIT_HIDPI_FACTOR` to do this on X11. Currently this is not updated at runtime using the live config update, there is not really much of a technical limitation why this woudn't be possible, however a solution for that issue should be first added in jwilm/alacritty#1346, once a system is established for changing DPI at runtime, porting that functionality to this PR should be simple.
Diffstat (limited to 'src/display.rs')
-rw-r--r--src/display.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/display.rs b/src/display.rs
index 733c66e8..2b87bf50 100644
--- a/src/display.rs
+++ b/src/display.rs
@@ -142,7 +142,11 @@ impl Display {
// get window properties for initializing the other subsystems
let mut viewport_size = window.inner_size_pixels()
.expect("glutin returns window size");
- let dpr = window.hidpi_factor();
+ let dpr = if config.font().scale_with_dpi() {
+ window.hidpi_factor()
+ } else {
+ 1.0
+ };
info!("device_pixel_ratio: {}", dpr);
@@ -150,7 +154,7 @@ impl Display {
let mut renderer = QuadRenderer::new(config, viewport_size)?;
let (glyph_cache, cell_width, cell_height) =
- Self::new_glyph_cache(&window, &mut renderer, config)?;
+ Self::new_glyph_cache(dpr, &mut renderer, config)?;
let dimensions = options.dimensions()
@@ -211,11 +215,10 @@ impl Display {
})
}
- fn new_glyph_cache(window : &Window, renderer : &mut QuadRenderer, config: &Config)
+ fn new_glyph_cache(dpr: f32, renderer: &mut QuadRenderer, config: &Config)
-> Result<(GlyphCache, f32, f32), Error>
{
let font = config.font().clone();
- let dpr = window.hidpi_factor();
let rasterizer = font::Rasterizer::new(dpr, config.use_thin_strokes())?;
// Initialize glyph cache