diff options
author | Christian Duerr <contact@christianduerr.com> | 2018-09-23 21:10:45 +0200 |
---|---|---|
committer | Christian Duerr <contact@christianduerr.com> | 2018-09-23 21:10:45 +0200 |
commit | 31362dd3b84993f493b3f5ab0fdb00646a636276 (patch) | |
tree | 518edeae06ad9f9981a51327c2e1e8b8aeebfcd6 | |
parent | a4cb1167eb56817a9b15ed9b85bc137c3d7a513a (diff) | |
download | alacritty-31362dd3b84993f493b3f5ab0fdb00646a636276.tar.gz alacritty-31362dd3b84993f493b3f5ab0fdb00646a636276.zip |
Fix window resize with DPI change
When the DPI factor changed and the window hasn't been resized,
Alacritty incorrectly resized the window to the previous size without
scaling it by the new DPI factor.
This has been fixed by making sure that every resize event triggered by
a DPI change uses the DPI factor to scale the window.
-rw-r--r-- | src/display.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/display.rs b/src/display.rs index 0c0f0aac..2640f69b 100644 --- a/src/display.rs +++ b/src/display.rs @@ -292,19 +292,19 @@ impl Display { // Font size/DPI factor modification detected if terminal.font_size != self.font_size || (dpr - self.size_info.dpr).abs() > f64::EPSILON { - self.font_size = terminal.font_size; - self.size_info.dpr = dpr; - self.size_info.padding_x = (f64::from(config.padding().x) * dpr).floor() as f32; - self.size_info.padding_y = (f64::from(config.padding().y) * dpr).floor() as f32; - self.update_glyph_cache(config); - if new_size == None { // Force a resize to refresh things new_size = Some(PhysicalSize::new( - f64::from(self.size_info.width), - f64::from(self.size_info.height), + f64::from(self.size_info.width) / self.size_info.dpr * dpr, + f64::from(self.size_info.height) / self.size_info.dpr * dpr, )); } + + self.font_size = terminal.font_size; + self.size_info.dpr = dpr; + self.size_info.padding_x = (f64::from(config.padding().x) * dpr).floor() as f32; + self.size_info.padding_y = (f64::from(config.padding().y) * dpr).floor() as f32; + self.update_glyph_cache(config); } // Receive any resize events; only call gl::Viewport on last |