From 5b85e80b75b2aa158a6b768180db7d2e70c14232 Mon Sep 17 00:00:00 2001 From: Greg V Date: Tue, 7 Sep 2021 02:17:54 +0300 Subject: [PATCH] window: fix synthesized configure event for Wayland DPI scale (fixes #1111) --- window/src/os/wayland/window.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/window/src/os/wayland/window.rs b/window/src/os/wayland/window.rs index 2a6bc63bc..b38c94320 100644 --- a/window/src/os/wayland/window.rs +++ b/window/src/os/wayland/window.rs @@ -537,13 +537,15 @@ impl WaylandWindowInner { self.window_state = window_state; } - if pending.configure.is_none() && pending.dpi.is_some() { - // Synthesize a pending configure event for the dpi change - pending.configure.replace(( - self.pixels_to_surface(self.dimensions.pixel_width as i32) as u32, - self.pixels_to_surface(self.dimensions.pixel_height as i32) as u32, - )); - log::debug!("synthesize configure with {:?}", pending.configure); + if pending.configure.is_none() { + if let Some(scale) = pending.dpi { + // Synthesize a pending configure event for the dpi change + pending.configure.replace(( + self.pixels_to_surface(self.dimensions.pixel_width as i32 * scale) as u32, + self.pixels_to_surface(self.dimensions.pixel_height as i32 * scale) as u32, + )); + log::debug!("synthesize configure with {:?}", pending.configure); + } } if let Some((w, h)) = pending.configure.take() {