From eadd7504120c8e0bf1959262fef7fda557f199eb Mon Sep 17 00:00:00 2001 From: Connor Fitzgerald Date: Wed, 22 Nov 2023 15:50:12 -0500 Subject: [PATCH] Fix Mac Event Loop (#4753) * Fix mac * Format --- examples/common/src/framework.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/examples/common/src/framework.rs b/examples/common/src/framework.rs index 09f02acab..74b89454d 100644 --- a/examples/common/src/framework.rs +++ b/examples/common/src/framework.rs @@ -434,6 +434,14 @@ async fn start(title: &str) { println!("{:#?}", context.instance.generate_report()); } WindowEvent::RedrawRequested => { + // On MacOS, currently redraw requested comes in _before_ Init does. + // If this happens, just drop the requested redraw on the floor. + // + // See https://github.com/rust-windowing/winit/issues/3235 for some discussion + if example.is_none() { + return; + } + frame_counter.update(); let frame = surface.acquire(&context);