mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:08:13 +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
|
@ -60,10 +60,15 @@ WallpaperMode mode_to_enum(const String& name)
|
|||
|
||||
Compositor::Compositor()
|
||||
{
|
||||
m_display_link_notify_timer = add<Core::Timer>(
|
||||
1000 / 60, [this] {
|
||||
notify_display_links();
|
||||
});
|
||||
m_display_link_notify_timer->stop();
|
||||
|
||||
m_compose_timer = Core::Timer::create_single_shot(
|
||||
1000 / 60,
|
||||
[this] {
|
||||
notify_display_links();
|
||||
compose();
|
||||
},
|
||||
this);
|
||||
|
@ -488,4 +493,19 @@ void Compositor::notify_display_links()
|
|||
});
|
||||
}
|
||||
|
||||
void Compositor::increment_display_link_count(Badge<ClientConnection>)
|
||||
{
|
||||
++m_display_link_count;
|
||||
if (m_display_link_count == 1)
|
||||
m_display_link_notify_timer->start();
|
||||
}
|
||||
|
||||
void Compositor::decrement_display_link_count(Badge<ClientConnection>)
|
||||
{
|
||||
ASSERT(m_display_link_count);
|
||||
--m_display_link_count;
|
||||
if (!m_display_link_count)
|
||||
m_display_link_notify_timer->stop();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue