mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 15:48:12 +00:00
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. :^)
This commit is contained in:
parent
9f54ea9bcd
commit
7efb497837
2 changed files with 14 additions and 0 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue