diff options
author | Andreas Kling <kling@serenityos.org> | 2021-07-05 18:47:54 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-07-05 20:03:31 +0200 |
commit | 27fecf57bd6644b82fab323e751f81b17c59934c (patch) | |
tree | 4c221ae2603af3820a84c2b37fd0850405318493 | |
parent | 9f1f3c6f3763c52376837085c6b27a0f280e80c0 (diff) | |
download | serenity-27fecf57bd6644b82fab323e751f81b17c59934c.zip |
LibGUI: Don't fire visibility-tracking timers in non-visible widgets
We were already avoiding firing timers within non-visible *windows*.
This patch extends the mechanism to support timers within non-visible
*widgets*.
-rw-r--r-- | Userland/Libraries/LibGUI/Widget.cpp | 5 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/Widget.h | 2 |
2 files changed, 7 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGUI/Widget.cpp b/Userland/Libraries/LibGUI/Widget.cpp index 026bab275b..491040d082 100644 --- a/Userland/Libraries/LibGUI/Widget.cpp +++ b/Userland/Libraries/LibGUI/Widget.cpp @@ -1114,4 +1114,9 @@ bool Widget::has_pending_drop() const return Application::the()->pending_drop_widget() == this; } +bool Widget::is_visible_for_timer_purposes() const +{ + return is_visible(); +} + } diff --git a/Userland/Libraries/LibGUI/Widget.h b/Userland/Libraries/LibGUI/Widget.h index 647d75b279..3090b6799c 100644 --- a/Userland/Libraries/LibGUI/Widget.h +++ b/Userland/Libraries/LibGUI/Widget.h @@ -108,6 +108,8 @@ public: set_max_height(height); } + virtual bool is_visible_for_timer_purposes() const override; + bool has_tooltip() const { return !m_tooltip.is_empty(); } String tooltip() const { return m_tooltip; } void set_tooltip(String); |