1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-24 05:42:03 +03:00

wayland: Actually properly fix HiDPI initialization

The issue was that surface vs pixel conversions used dpi which wasn't updated yet.
This commit is contained in:
Greg V 2021-10-23 15:43:56 +03:00 committed by Wez Furlong
parent a1209096f6
commit c6062d9d22

View File

@ -566,8 +566,8 @@ impl WaylandWindowInner {
if let Some(scale) = pending.dpi { if let Some(scale) = pending.dpi {
// Synthesize a pending configure event for the dpi change // Synthesize a pending configure event for the dpi change
pending.configure.replace(( pending.configure.replace((
self.pixels_to_surface(self.dimensions.pixel_width as i32 * scale) as u32, self.pixels_to_surface(self.dimensions.pixel_width as i32) as u32,
self.pixels_to_surface(self.dimensions.pixel_height as i32 * scale) as u32, self.pixels_to_surface(self.dimensions.pixel_height as i32) as u32,
)); ));
log::debug!("synthesize configure with {:?}", pending.configure); log::debug!("synthesize configure with {:?}", pending.configure);
} }
@ -577,6 +577,9 @@ impl WaylandWindowInner {
if self.window.is_some() { if self.window.is_some() {
let factor = get_surface_scale_factor(&self.surface); let factor = get_surface_scale_factor(&self.surface);
// Do this early because this affects surface_to_pixels/pixels_to_surface below!
self.dimensions.dpi = factor as usize * crate::DEFAULT_DPI as usize;
let mut pixel_width = self.surface_to_pixels(w.try_into().unwrap()); let mut pixel_width = self.surface_to_pixels(w.try_into().unwrap());
let mut pixel_height = self.surface_to_pixels(h.try_into().unwrap()); let mut pixel_height = self.surface_to_pixels(h.try_into().unwrap());