[examples] Do not request redraw on resize

This is no longer necessary, since Winit can now properly issue redraw
events on resize.
This commit is contained in:
Mads Marquart 2024-09-11 22:33:24 +02:00
parent 9a5e646464
commit 9565109659
4 changed files with 0 additions and 9 deletions

View File

@ -422,8 +422,6 @@ async fn start<E: Example>(title: &str) {
&context.device,
&context.queue,
);
window_loop.window.request_redraw();
}
WindowEvent::KeyboardInput {
event:

View File

@ -81,7 +81,6 @@ async fn run(event_loop: EventLoop<()>, window: Window) {
.unwrap();
surface.configure(&device, &config);
let window = &window;
event_loop
.run(move |event, target| {
// Have the closure take ownership of the resources.
@ -100,8 +99,6 @@ async fn run(event_loop: EventLoop<()>, window: Window) {
config.width = new_size.width.max(1);
config.height = new_size.height.max(1);
surface.configure(&device, &config);
// On macos the window needs to be redrawn manually after resizing
window.request_redraw();
}
WindowEvent::RedrawRequested => {
let frame = surface

View File

@ -100,8 +100,6 @@ async fn run(event_loop: EventLoop<()>, viewports: Vec<(Arc<Window>, wgpu::Color
// Recreate the swap chain with the new size
if let Some(viewport) = viewports.get_mut(&window_id) {
viewport.resize(&device, new_size);
// On macos the window needs to be redrawn manually after resizing
viewport.desc.window.request_redraw();
}
}
WindowEvent::RedrawRequested => {

View File

@ -217,7 +217,6 @@ impl WgpuContext {
self.surface_config.width = new_size.width;
self.surface_config.height = new_size.height;
self.surface.configure(&self.device, &self.surface_config);
self.window.request_redraw();
}
}
@ -285,7 +284,6 @@ async fn run(event_loop: EventLoop<()>, window: Arc<Window>) {
WindowEvent::Resized(new_size) => {
let wgpu_context_mut = wgpu_context.as_mut().unwrap();
wgpu_context_mut.resize(new_size);
wgpu_context_mut.window.request_redraw();
}
WindowEvent::RedrawRequested => {
let wgpu_context_ref = wgpu_context.as_ref().unwrap();