mirror of
https://github.com/alacritty/alacritty.git
synced 2024-11-18 13:55:23 -05:00
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.
This commit is contained in:
parent
a4cb1167eb
commit
31362dd3b8
1 changed files with 8 additions and 8 deletions
|
@ -292,19 +292,19 @@ impl Display {
|
||||||
|
|
||||||
// Font size/DPI factor modification detected
|
// Font size/DPI factor modification detected
|
||||||
if terminal.font_size != self.font_size || (dpr - self.size_info.dpr).abs() > f64::EPSILON {
|
if terminal.font_size != self.font_size || (dpr - self.size_info.dpr).abs() > f64::EPSILON {
|
||||||
|
if new_size == None {
|
||||||
|
// Force a resize to refresh things
|
||||||
|
new_size = Some(PhysicalSize::new(
|
||||||
|
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.font_size = terminal.font_size;
|
||||||
self.size_info.dpr = dpr;
|
self.size_info.dpr = dpr;
|
||||||
self.size_info.padding_x = (f64::from(config.padding().x) * dpr).floor() as f32;
|
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.size_info.padding_y = (f64::from(config.padding().y) * dpr).floor() as f32;
|
||||||
self.update_glyph_cache(config);
|
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),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Receive any resize events; only call gl::Viewport on last
|
// Receive any resize events; only call gl::Viewport on last
|
||||||
|
|
Loading…
Reference in a new issue