mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 17:10:23 +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
Notes:
sideshowbarker
2024-07-19 09:16:07 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/7efb4978374
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);
|
||||
|
||||
|
|
|
@ -38,6 +38,8 @@ public:
|
|||
|
||||
private:
|
||||
NotificationWindow(const String& text, const String& title);
|
||||
|
||||
Gfx::Rect m_original_rect;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue