mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-03 07:07:23 +00:00
LibCore+LibGUI: Don't fire timers in non-visible windows by default
LibCore timers now have a TimerShouldFireWhenNotVisible flag which is set to "No" by default. If "No", the timer will not be fired by the event loop if it's within a CObject tree whose nearest GWindow ancestor is currently not visible for timer purposes. (Specificially, this means that the window is either minimized or fully occluded, and so does not want to fire timers just to update the UI.) This is another nice step towards a calm and serene operating system.
This commit is contained in:
@@ -589,6 +589,8 @@ void GWindow::update_all_windows(Badge<GWindowServerConnection>)
|
||||
|
||||
void GWindow::notify_state_changed(Badge<GWindowServerConnection>, bool minimized, bool occluded)
|
||||
{
|
||||
m_visible_for_timer_purposes = !minimized && !occluded;
|
||||
|
||||
// When double buffering is enabled, minimization/occlusion means we can mark the front bitmap volatile (in addition to the back bitmap.)
|
||||
// When double buffering is disabled, there is only the back bitmap (which we can now mark volatile!)
|
||||
RefPtr<GraphicsBitmap>& bitmap = m_double_buffering_enabled ? m_front_bitmap : m_back_bitmap;
|
||||
|
||||
Reference in New Issue
Block a user