1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 05:28:11 +00:00

WindowServer+LibGUI: Add a way to get notified at display refresh rate

This patch adds GUI::DisplayLink, a mechanism for registering callbacks
that will fire at the display refresh rate.

Note that we don't actually know the screen refresh rate, but this is
instead completely driven by WindowServer's compositing timer. For all
current intents and purposes it does the job well enough. :^)
This commit is contained in:
Andreas Kling 2020-03-22 21:13:23 +01:00
parent bb70d0692b
commit 424a3f5ac3
11 changed files with 183 additions and 0 deletions

View file

@ -734,4 +734,22 @@ OwnPtr<Messages::WindowServer::SetWindowBaseSizeAndSizeIncrementResponse> Client
return make<Messages::WindowServer::SetWindowBaseSizeAndSizeIncrementResponse>();
}
void ClientConnection::handle(const Messages::WindowServer::EnableDisplayLink&)
{
m_has_display_link = true;
}
void ClientConnection::handle(const Messages::WindowServer::DisableDisplayLink&)
{
m_has_display_link = false;
}
void ClientConnection::notify_display_link(Badge<Compositor>)
{
if (!m_has_display_link)
return;
post_message(Messages::WindowClient::DisplayLinkNotification());
}
}