From 0f4304edd1a3bcf3631219c1d01ce0a2bd08fa89 Mon Sep 17 00:00:00 2001 From: Sasha Szpakowski Date: Sun, 15 Jan 2023 12:36:15 -0400 Subject: [PATCH] Pump events a couple times during bootup. Fixes unexpectedly slow first frames on macOS. Fixes #1859 --- src/modules/love/boot.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/modules/love/boot.lua b/src/modules/love/boot.lua index bec1f66ba..038cab634 100644 --- a/src/modules/love/boot.lua +++ b/src/modules/love/boot.lua @@ -304,6 +304,13 @@ function love.init() end end + -- The first couple event pumps on some systems (e.g. macOS) can take a + -- while. We'd rather hit that slowdown here than in event processing + -- within the first frames. + if love.event then + for i = 1, 2 do love.event.pump() end + end + -- Our first timestep, because window creation can take some time if love.timer then love.timer.step()