From fc2c5c373bc89b7b9e0495afbce528b51dd88ca4 Mon Sep 17 00:00:00 2001 From: Laria Carolin Chabowski Date: Sat, 2 Jan 2021 22:43:13 +0100 Subject: [PATCH] NotificationServer: Reposition notifications on screen resolution change Previously notifications were (partially) drawn outside the screen rect if they were created before changing the screen resolution to smaller dimensions. This prevented the user from dismissing the notification as the close button was no longer clickable. --- Services/NotificationServer/NotificationWindow.cpp | 2 +- Services/NotificationServer/NotificationWindow.h | 2 ++ Services/NotificationServer/main.cpp | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Services/NotificationServer/NotificationWindow.cpp b/Services/NotificationServer/NotificationWindow.cpp index d8b3531836..e5739b1c3b 100644 --- a/Services/NotificationServer/NotificationWindow.cpp +++ b/Services/NotificationServer/NotificationWindow.cpp @@ -41,7 +41,7 @@ namespace NotificationServer { static Vector> s_windows; -static void update_notification_window_locations() +void update_notification_window_locations() { Gfx::IntRect last_window_rect; for (auto& window : s_windows) { diff --git a/Services/NotificationServer/NotificationWindow.h b/Services/NotificationServer/NotificationWindow.h index 5c0a710301..607365fe6e 100644 --- a/Services/NotificationServer/NotificationWindow.h +++ b/Services/NotificationServer/NotificationWindow.h @@ -30,6 +30,8 @@ namespace NotificationServer { +void update_notification_window_locations(); + class NotificationWindow final : public GUI::Window { C_OBJECT(NotificationWindow); diff --git a/Services/NotificationServer/main.cpp b/Services/NotificationServer/main.cpp index 125f8b711d..bc74083489 100644 --- a/Services/NotificationServer/main.cpp +++ b/Services/NotificationServer/main.cpp @@ -25,8 +25,10 @@ */ #include "ClientConnection.h" +#include "NotificationWindow.h" #include #include +#include #include #include #include @@ -66,5 +68,7 @@ int main(int argc, char** argv) return 1; } + GUI::Desktop::the().on_rect_change = [](auto&) { NotificationServer::update_notification_window_locations(); }; + return app->exec(); }