WindowServer+LibGUI: Notify DisplayLinks at 60 fps no matter what

The original implementation only sent out notifications when there was
something being drawn on screen. If nothing was going on, we'd get too
lazy and just not notify display links.

This obviously break requestAnimationFrame(), so now we just drive the
DisplayLinks at 60 fps no matter what. :^)
This commit is contained in:
Andreas Kling 2020-04-22 00:07:48 +02:00
parent 2d4c91df8e
commit 5326eebb1b
Notes: sideshowbarker 2024-07-19 07:24:34 +09:00
5 changed files with 47 additions and 2 deletions

View file

@ -342,7 +342,14 @@ void WindowServerConnection::handle(const Messages::WindowClient::WindowStateCha
void WindowServerConnection::handle(const Messages::WindowClient::DisplayLinkNotification&)
{
DisplayLink::notify({});
if (m_display_link_notification_pending)
return;
m_display_link_notification_pending = true;
deferred_invoke([this](auto&) {
DisplayLink::notify({});
m_display_link_notification_pending = false;
});
}
}