don't panic when minimizing the window on Windows

closes: https://github.com/wez/wezterm/issues/45
This commit is contained in:
Wez Furlong committed 2019-10-25 07:20:21 -07:00
1 parent 1196f2bbf7
commit fc918c2f4d
2 files changed
+12

No files matched your search

+7
View File
@@ -178,6 +178,13 @@ impl TerminalWindow for GliumTerminalWindow {
.ok_or_else(|| format_err!("failed to get inner window size"))?;
let dpi_scale = self.host.display.gl_window().get_hidpi_factor();
let (width, height): (u32, u32) = size.to_physical(dpi_scale).into();
if width == 0 || height == 0 {
// on windows, this can happen when minimizing the window.
// NOP!
return Ok(());
}
debug!(
"resize {}x{}@{} -> {}x{}@{}",
self.width, self.height, old_dpi_scale, width, height, dpi_scale
+5
View File
@@ -738,6 +738,11 @@ impl WindowCallbacks for TermWindow {
}
fn resize(&mut self, dimensions: Dimensions) {
if dimensions.pixel_width == 0 || dimensions.pixel_height == 0 {
// on windows, this can happen when minimizing the window.
// NOP!
return;
}
self.scaling_changed(dimensions, self.fonts.get_font_scale());
}