From f2814dd6c17fa0f5103f68c25c5a0cb53eac37a9 Mon Sep 17 00:00:00 2001 From: Nick Johnson Date: Thu, 11 Mar 2021 14:09:37 -0600 Subject: [PATCH] Notification: Allow getting window by ID This is a neccessity so a connection can get the notification it is connected to for later updates. --- Userland/Services/NotificationServer/NotificationWindow.cpp | 6 ++++++ Userland/Services/NotificationServer/NotificationWindow.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/Userland/Services/NotificationServer/NotificationWindow.cpp b/Userland/Services/NotificationServer/NotificationWindow.cpp index 696436b2b2e..ed5953c2f2c 100644 --- a/Userland/Services/NotificationServer/NotificationWindow.cpp +++ b/Userland/Services/NotificationServer/NotificationWindow.cpp @@ -128,4 +128,10 @@ NotificationWindow::~NotificationWindow() { } +RefPtr NotificationWindow::get_window_by_id(i32 id) +{ + auto window = s_windows.get(id); + return window.value_or(nullptr); +} + } diff --git a/Userland/Services/NotificationServer/NotificationWindow.h b/Userland/Services/NotificationServer/NotificationWindow.h index f2654ddda76..48169663b39 100644 --- a/Userland/Services/NotificationServer/NotificationWindow.h +++ b/Userland/Services/NotificationServer/NotificationWindow.h @@ -39,6 +39,8 @@ public: virtual ~NotificationWindow() override; void set_original_rect(Gfx::IntRect original_rect) { m_original_rect = original_rect; }; + static RefPtr get_window_by_id(i32 id); + private: NotificationWindow(i32 client_id, const String& text, const String& title, const Gfx::ShareableBitmap&);