windows: avoid panic when minimizing w/ WebGpu

```
thread 'main' panicked at 'Error in Surface::configure: Both `Surface` width and height must be non-zero. Wait to recreate the `Surface` until the window has non-zero area.', C:\Users\runneradmin\.cargo\registry\src\github.com-1ecc6299db9ec823\wgpu-0.14.0\src\backend\direct.rs:274:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```

refs: https://github.com/wez/wezterm/issues/2881
This commit is contained in:
Wez Furlong committed 2022-12-30 08:52:01 -07:00
1 parent 130990480f
commit fc481106af
2 files changed
+8 -1

No files matched your search

+2
View File
@@ -27,6 +27,8 @@ As features stabilize some brief notes about them will accumulate here.
[#2819](https://github.com/wez/wezterm/issues/2819)
* `wezterm ssh` now respects the `AddressFamily` option when connecting
[#2893](https://github.com/wez/wezterm/issues/2893)
* Windows: panic when minimizing a window when `front_end='WebGpu'`
[#2881](https://github.com/wez/wezterm/issues/2881)
#### Changed
* `CTRL-SHIFT-P` now activates the new command palette, instead of `PaneSelect`
+6 -1
View File
@@ -474,6 +474,11 @@ impl WebGpuState {
let mut config = self.config.borrow_mut();
config.width = dims.pixel_width as u32;
config.height = dims.pixel_height as u32;
self.surface.configure(&self.device, &config);
if config.width > 0 && config.height > 0 {
// Avoid reconfiguring with a 0 sized surface, as webgpu will
// panic in that case
// <https://github.com/wez/wezterm/issues/2881>
self.surface.configure(&self.device, &config);
}
}
}