summaryrefslogtreecommitdiff
path: root/Servers
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-02-16 19:51:44 +0100
committerAndreas Kling <kling@serenityos.org>2020-02-16 21:58:17 +0100
commit7efb497837422447a0913915967dc341f334ba3a (patch)
treeee60f1e650b1d770a692ee46c76aff44d73ddbc0 /Servers
parent9f54ea9bcd81567f4250cdea4b4f21f249e6d7b4 (diff)
downloadserenity-7efb497837422447a0913915967dc341f334ba3a.zip
NotificationServer: Add new notification windows below the lowest one
Don't stack notifications on top of each other, instead put them below one another on the y axis. This will obviously break if the screen fills with notifications, but that's a FIXME for now. :^)
Diffstat (limited to 'Servers')
-rw-r--r--Servers/NotificationServer/NotificationWindow.cpp12
-rw-r--r--Servers/NotificationServer/NotificationWindow.h2
2 files changed, 14 insertions, 0 deletions
diff --git a/Servers/NotificationServer/NotificationWindow.cpp b/Servers/NotificationServer/NotificationWindow.cpp
index 1fca0803de..2bfb35d5de 100644
--- a/Servers/NotificationServer/NotificationWindow.cpp
+++ b/Servers/NotificationServer/NotificationWindow.cpp
@@ -43,12 +43,24 @@ NotificationWindow::NotificationWindow(const String& text, const String& title)
set_window_type(GUI::WindowType::Tooltip);
+ Gfx::Rect lowest_notification_rect_on_screen;
+ for (auto& window : s_windows) {
+ if (window->m_original_rect.y() > lowest_notification_rect_on_screen.y())
+ lowest_notification_rect_on_screen = window->m_original_rect;
+ }
+
Gfx::Rect rect;
rect.set_width(200);
rect.set_height(40);
rect.set_location(GUI::Desktop::the().rect().top_right().translated(-rect.width() - 8, 26));
+
+ if (!lowest_notification_rect_on_screen.is_null())
+ rect.set_location(lowest_notification_rect_on_screen.bottom_left().translated(0, 8));
+
set_rect(rect);
+ m_original_rect = rect;
+
auto widget = GUI::Widget::construct();
widget->set_fill_with_background_color(true);
diff --git a/Servers/NotificationServer/NotificationWindow.h b/Servers/NotificationServer/NotificationWindow.h
index 73f19e59b9..dd13a65f86 100644
--- a/Servers/NotificationServer/NotificationWindow.h
+++ b/Servers/NotificationServer/NotificationWindow.h
@@ -38,6 +38,8 @@ public:
private:
NotificationWindow(const String& text, const String& title);
+
+ Gfx::Rect m_original_rect;
};
}