From 95651096596f134672ca0d12b0191f418cd52906 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Wed, 11 Sep 2024 22:33:24 +0200 Subject: [PATCH] [examples] Do not request redraw on resize This is no longer necessary, since Winit can now properly issue redraw events on resize. --- examples/src/framework.rs | 2 -- examples/src/hello_triangle/mod.rs | 3 --- examples/src/hello_windows/mod.rs | 2 -- examples/src/uniform_values/mod.rs | 2 -- 4 files changed, 9 deletions(-) diff --git a/examples/src/framework.rs b/examples/src/framework.rs index ff86cc2357..c4d4cf4a9f 100644 --- a/examples/src/framework.rs +++ b/examples/src/framework.rs @@ -422,8 +422,6 @@ async fn start(title: &str) { &context.device, &context.queue, ); - - window_loop.window.request_redraw(); } WindowEvent::KeyboardInput { event: diff --git a/examples/src/hello_triangle/mod.rs b/examples/src/hello_triangle/mod.rs index 7c82d49cf0..6d425555bf 100644 --- a/examples/src/hello_triangle/mod.rs +++ b/examples/src/hello_triangle/mod.rs @@ -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 diff --git a/examples/src/hello_windows/mod.rs b/examples/src/hello_windows/mod.rs index b568f35d38..349d0d5f25 100644 --- a/examples/src/hello_windows/mod.rs +++ b/examples/src/hello_windows/mod.rs @@ -100,8 +100,6 @@ async fn run(event_loop: EventLoop<()>, viewports: Vec<(Arc, 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 => { diff --git a/examples/src/uniform_values/mod.rs b/examples/src/uniform_values/mod.rs index 1ef58de09a..1e671056b0 100644 --- a/examples/src/uniform_values/mod.rs +++ b/examples/src/uniform_values/mod.rs @@ -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) { 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();