From 1207afa7d0862b0fa06b8dd9dd01acb03e49acec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n=20Jim=C3=A9nez?= Date: Fri, 26 Mar 2021 14:46:19 +0100 Subject: [PATCH] Skip redrawing if window has no surface --- winit/src/application.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/winit/src/application.rs b/winit/src/application.rs index 5aefb378..ef6c8463 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -299,11 +299,16 @@ async fn run_instance( messages.push(message); } event::Event::RedrawRequested(_) => { + let physical_size = state.physical_size(); + + if physical_size.width == 0 || physical_size.height == 0 { + continue; + } + debug.render_started(); let current_viewport_version = state.viewport_version(); if viewport_version != current_viewport_version { - let physical_size = state.physical_size(); let logical_size = state.logical_size(); debug.layout_started();