mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:47:44 +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:
parent
f8f2b8b520
commit
411d293961
6 changed files with 42 additions and 9 deletions
|
@ -38,7 +38,7 @@ public:
|
|||
|
||||
bool was_exit_requested() const { return m_exit_requested; }
|
||||
|
||||
static int register_timer(CObject&, int milliseconds, bool should_reload);
|
||||
static int register_timer(CObject&, int milliseconds, bool should_reload, TimerShouldFireWhenNotVisible);
|
||||
static bool unregister_timer(int timer_id);
|
||||
|
||||
static void register_notifier(Badge<CNotifier>, CNotifier&);
|
||||
|
@ -77,6 +77,7 @@ private:
|
|||
int interval { 0 };
|
||||
timeval fire_time { 0, 0 };
|
||||
bool should_reload { false };
|
||||
TimerShouldFireWhenNotVisible fire_when_not_visible { TimerShouldFireWhenNotVisible::No };
|
||||
WeakPtr<CObject> owner;
|
||||
|
||||
void reload(const timeval& now);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue