summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaria Carolin Chabowski <laria@laria.me>2021-01-02 22:43:13 +0100
committerAndreas Kling <kling@serenityos.org>2021-01-02 23:17:30 +0100
commitfc2c5c373bc89b7b9e0495afbce528b51dd88ca4 (patch)
tree0b04c1139b2e2205137610f45c194c197853c5f4
parent2caf4e66eae53df535c782716d7ae33fa2a3d849 (diff)
downloadserenity-fc2c5c373bc89b7b9e0495afbce528b51dd88ca4.zip
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.
-rw-r--r--Services/NotificationServer/NotificationWindow.cpp2
-rw-r--r--Services/NotificationServer/NotificationWindow.h2
-rw-r--r--Services/NotificationServer/main.cpp4
3 files changed, 7 insertions, 1 deletions
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<RefPtr<NotificationWindow>> 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 <LibCore/LocalServer.h>
#include <LibGUI/Application.h>
+#include <LibGUI/Desktop.h>
#include <LibGUI/WindowServerConnection.h>
#include <stdio.h>
#include <unistd.h>
@@ -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();
}