more fault tollerant dpi handling

macos-click-through
Keith Simmons 5 years ago
parent cbe0eab3c7
commit c4d524287e

@ -220,13 +220,14 @@ impl WindowWrapper {
} }
pub fn draw_frame(&mut self) -> bool { pub fn draw_frame(&mut self) -> bool {
let new_size = LogicalSize::new(&self.window).unwrap(); if let Ok(new_size) = LogicalSize::new(&self.window) {
if self.previous_size != new_size { if self.previous_size != new_size {
handle_new_grid_size(new_size, &self.renderer); handle_new_grid_size(new_size, &self.renderer);
self.previous_size = new_size; self.previous_size = new_size;
} }
}
let new_dpis = dpis(&self.window).unwrap(); if let Ok(new_dpis) = dpis(&self.window) {
if self.previous_dpis != new_dpis { if self.previous_dpis != new_dpis {
let physical_size = PhysicalSize::new(&self.window); let physical_size = PhysicalSize::new(&self.window);
self.window.set_size( self.window.set_size(
@ -234,6 +235,7 @@ impl WindowWrapper {
(physical_size.height as f32 * new_dpis.1 / self.previous_dpis.1) as u32).unwrap(); (physical_size.height as f32 * new_dpis.1 / self.previous_dpis.1) as u32).unwrap();
self.previous_dpis = new_dpis; self.previous_dpis = new_dpis;
} }
}
debug!("Render Triggered"); debug!("Render Triggered");
if REDRAW_SCHEDULER.should_draw() || SETTINGS.get::<WindowSettings>().no_idle { if REDRAW_SCHEDULER.should_draw() || SETTINGS.get::<WindowSettings>().no_idle {

Loading…
Cancel
Save