summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGUI/Notification.h
diff options
context:
space:
mode:
authorNick Johnson <sylvyrfysh@gmail.com>2021-03-13 15:51:33 -0600
committerAndreas Kling <kling@serenityos.org>2021-03-22 12:46:16 +0100
commitddcef0452aad489a51f4cf3d67e7517f3e573e7c (patch)
treee192ceca0e59ab041ad6de6c5d62dfa0d4ed0e56 /Userland/Libraries/LibGUI/Notification.h
parent9d09594e4465bda1a3a62042997531a0de0332d9 (diff)
downloadserenity-ddcef0452aad489a51f4cf3d67e7517f3e573e7c.zip
NotificationServer: Close connection on notification close
When the notification was closed, the connection was kept around. This caused the core event loop to take up nearly all CPU, so instead of checking the connection we clear it on close and add state variables to check state.
Diffstat (limited to 'Userland/Libraries/LibGUI/Notification.h')
-rw-r--r--Userland/Libraries/LibGUI/Notification.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGUI/Notification.h b/Userland/Libraries/LibGUI/Notification.h
index e949d7fc24..86c3aeaf3e 100644
--- a/Userland/Libraries/LibGUI/Notification.h
+++ b/Userland/Libraries/LibGUI/Notification.h
@@ -36,6 +36,8 @@ class NotificationServerConnection;
class Notification : public Core::Object {
C_OBJECT(Notification);
+ friend class NotificationServerConnection;
+
public:
virtual ~Notification() override;
@@ -64,9 +66,13 @@ public:
bool update();
void close();
+ bool is_showing() const { return m_shown && !m_destroyed; }
+
private:
Notification();
+ void connection_closed();
+
String m_title;
bool m_title_dirty;
String m_text;
@@ -74,6 +80,8 @@ private:
RefPtr<Gfx::Bitmap> m_icon;
bool m_icon_dirty;
+ bool m_destroyed { false };
+ bool m_shown { false };
RefPtr<NotificationServerConnection> m_connection;
};