From a968bc6f809d1b1eec60c3e2dbb1255b0d62d1de Mon Sep 17 00:00:00 2001 From: Tim Ledbetter Date: Mon, 26 Feb 2024 17:52:03 +0000 Subject: [PATCH] Ladybird/Qt: Use a precise timer for event loop timer events This improves the accuracy of `setTimeout()`. --- Ladybird/Qt/EventLoopImplementationQt.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Ladybird/Qt/EventLoopImplementationQt.cpp b/Ladybird/Qt/EventLoopImplementationQt.cpp index b0f05aa45e..d2a981fe74 100644 --- a/Ladybird/Qt/EventLoopImplementationQt.cpp +++ b/Ladybird/Qt/EventLoopImplementationQt.cpp @@ -91,6 +91,7 @@ static void qt_timer_fired(Core::TimerShouldFireWhenNotVisible should_fire_when_ intptr_t EventLoopManagerQt::register_timer(Core::EventReceiver& object, int milliseconds, bool should_reload, Core::TimerShouldFireWhenNotVisible should_fire_when_not_visible) { auto timer = new QTimer; + timer->setTimerType(Qt::PreciseTimer); timer->setInterval(milliseconds); timer->setSingleShot(!should_reload); auto weak_object = object.make_weak_ptr();