mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:18:11 +00:00
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:
parent
2d4c91df8e
commit
5326eebb1b
5 changed files with 47 additions and 2 deletions
|
@ -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;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -75,6 +75,8 @@ private:
|
|||
virtual void handle(const Messages::WindowClient::UpdateSystemTheme&) override;
|
||||
virtual void handle(const Messages::WindowClient::WindowStateChanged&) override;
|
||||
virtual void handle(const Messages::WindowClient::DisplayLinkNotification&) override;
|
||||
|
||||
bool m_display_link_notification_pending { false };
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue