Skip to content

Commit

Permalink
window: fix synthesized configure event for Wayland DPI scale (fixes w…
Browse files Browse the repository at this point in the history
  • Loading branch information
valpackett committed Sep 6, 2021
1 parent 86f0bae commit 0f6acbd
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions window/src/os/wayland/window.rs
Expand Up @@ -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() {
Expand Down

0 comments on commit 0f6acbd

Please sign in to comment.