Skip to content

Commit 9565109

Browse files
committed
[examples] Do not request redraw on resize
This is no longer necessary, since Winit can now properly issue redraw events on resize.
1 parent 9a5e646 commit 9565109

File tree

4 files changed

+0
-9
lines changed

4 files changed

+0
-9
lines changed

examples/src/framework.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,8 +422,6 @@ async fn start<E: Example>(title: &str) {
422422
&context.device,
423423
&context.queue,
424424
);
425-
426-
window_loop.window.request_redraw();
427425
}
428426
WindowEvent::KeyboardInput {
429427
event:

examples/src/hello_triangle/mod.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ async fn run(event_loop: EventLoop<()>, window: Window) {
8181
.unwrap();
8282
surface.configure(&device, &config);
8383

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

examples/src/hello_windows/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,6 @@ async fn run(event_loop: EventLoop<()>, viewports: Vec<(Arc<Window>, wgpu::Color
100100
// Recreate the swap chain with the new size
101101
if let Some(viewport) = viewports.get_mut(&window_id) {
102102
viewport.resize(&device, new_size);
103-
// On macos the window needs to be redrawn manually after resizing
104-
viewport.desc.window.request_redraw();
105103
}
106104
}
107105
WindowEvent::RedrawRequested => {

examples/src/uniform_values/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,6 @@ impl WgpuContext {
217217
self.surface_config.width = new_size.width;
218218
self.surface_config.height = new_size.height;
219219
self.surface.configure(&self.device, &self.surface_config);
220-
self.window.request_redraw();
221220
}
222221
}
223222

@@ -285,7 +284,6 @@ async fn run(event_loop: EventLoop<()>, window: Arc<Window>) {
285284
WindowEvent::Resized(new_size) => {
286285
let wgpu_context_mut = wgpu_context.as_mut().unwrap();
287286
wgpu_context_mut.resize(new_size);
288-
wgpu_context_mut.window.request_redraw();
289287
}
290288
WindowEvent::RedrawRequested => {
291289
let wgpu_context_ref = wgpu_context.as_ref().unwrap();

0 commit comments

Comments
 (0)